How can I change the radius of a circle pointeur

2 ビュー (過去 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 件のコメント
Marie BILLARD
Marie BILLARD 2017 年 4 月 12 日
ok thank you @Jan Simon

サインインしてコメントする。

その他の回答 (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 Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by