How can I get CurrentPoint to display the coordinates within a figures axes rather than the coordinates of the whole figure itself.
18 ビュー (過去 30 日間)
古いコメントを表示
Hi Everyone,
I'm totally new to matlab so please bear with me.
I've created a GUI using GUIDE which converts and plots data from .BIN files (not important but just to give context) and I want to be able to view the cursors current position relative to the axes scale.
I've managed to get the cursor position relative to the figure window by using
new_point = get(handles.figure,'CurrentPoint');
set(handles.editbox,'String',new_point)
but since the axes don't have a 'CurrentPosition' nor a callback for 'WindowButtonMotionFcn' I can't seem to get values relative to my axes.
Is the only way to get around this to multiply the 'CurrentPosition' result (in my case 'new_point') by a vector equation which corresponds to the axes I've created, or is there another way to get around this?
In an ideal world I would be able to use DataCursor but unfortunately I'm using MATLAB version 6.1.
I'll be ever so grateful for any insight anyone could lend on this,
Thanks,
Rosie
0 件のコメント
採用された回答
その他の回答 (2 件)
Simon Thalén
2015 年 6 月 19 日
Im using get(handle,'CurrentPoint') within my own callback for buttonpress so i really don't want to use ginput..
I found out that when i replaced my handle for axes with simply gco it gave me the correct coordinates. I.E coordinates on the format of my axes if that makes any sense.
So for anyone having the same problem as Rosie try that
0 件のコメント
William Chamberlain
2018 年 4 月 12 日
gcf_currentpoint = get(gcf, 'CurrentPoint')
gives the pixel coordinates
axes_handle = gca
pt = get(axes_handle, 'CurrentPoint')
gives the relative position inside the axes (top right is 1,1 - bottom left is 0,0)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!