필터 지우기
필터 지우기

How can I change the radius of a circle pointeur

조회 수: 3 (최근 30일)
Marie BILLARD
Marie BILLARD 2017년 4월 11일
댓글: Marie BILLARD 2017년 4월 12일
Hi, I'm using the "myginput.m" function and I would like to change the radius of my circle pointer. However, I haven't succeeded. Would anybody have a or the solution ? Thank you in advance.
  댓글 수: 2
KSSV
KSSV 2017년 4월 11일
What is this function myginput.m? And where you want to change the pointer?
Marie BILLARD
Marie BILLARD 2017년 4월 11일
I found myginput.m function on this link : https://fr.mathworks.com/matlabcentral/fileexchange/12770-myginput So I can change my "arrow" pointer on "circle" pointer. But I don't know how to increase the radius of this circle.

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2017년 4월 11일
편집: Jan 2017년 4월 12일
This function can set exactly the same pointers as explained in the documentation: See doc figure "pointers" . You cannot set the radius of the circle pointer.
If you want to choose the radius freely, you need to draw the circle by your own.
[EDITED] For creating a 32x32 pointer, see the "PointerShapeCData" point in the posted link.
CData = [ ...
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1; ...
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2; ...
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 0, 0; ...
0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 0, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
LUT = [NaN, 1, 2]; % Transparent, black, white
Shape = LUT(CData + 1);
Shape = cat(2, Shape, fliplr(Shape));
Shape = cat(1, Shape, flipud(Shape));
figure('Pointer', 'custom', 'PointerShapeCData', Shape);
This is a circle with 32 pixels diameter with black pixels and a white circle inside. This is visible on light and dark images. If only the black circle is wanted, use: LUT = [NaN, 1, NaN]
Set the 'PointerShapeHotSpot' to [16, 16]. Note, that the center is not exactly at the midpoint of the circle. To get this create a circle with an odd number of pixels.

추가 답변 (1개)

Thorsten
Thorsten 2017년 4월 11일
You have to define your own pointer as a 16 x 16 matrix and then change the line in myginput that changes the pointer to use your pointer. See http://matlab.izmiran.ru/help/techdoc/creating_plots/figure12.html for details how to define a pointer.
  댓글 수: 5
Guillaume
Guillaume 2017년 4월 12일
편집: Guillaume 2017년 4월 12일
In which documentation can I find it ?
The one that comes with your copy of matlab! At least, R2017a says it can be 32x32.
At matlab command prompt:
web(fullfile(docroot, 'matlab/ref/figure-properties.html#property_d0e277605'))
Or you could just try and see if it works:
hfig = figure;
custompointer = ones(32); custompointer(2:end-1, 2:end-1) = nan; %32x32 square
hfig.Pointer = 'custom';
hfig.PointerShapeCData = custompointer;
edit: it would appear that 32x32 was added in R2016b
Marie BILLARD
Marie BILLARD 2017년 4월 12일
Thank you for your help @Guillaume

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by