with the help of datacursormode and getposition, I am able to find the coordinates of selected points , how can I save those coordinates...?
Show older comments
hdt = datacursormode;
set(hdt,'UpdateFcn',{@labeldtips,hdt});
dcs=hdt.DataCursors;
pos = get(dcs(1),'Position'); %Position of 1st cursor
output_txt{1} = ['X: ', num2str(pos(1))];
output_txt{2} = ['Y: ', num2str(pos(2))];
1 Comment
Stephen23
on 11 Jan 2016
@supriya kadam: today I formatted your code correctly for you. In future please do it yourself by first selecting the code text and then clicking the {} Code button. It really is that easy!
Answers (1)
Walter Roberson
on 11 Jan 2016
0 votes
data cursor mode is not appropriate for saving points. Use ginput(), or impoint(); or put an axes ButtonDownFcn callback and in that callback get() the axes CurrentPoint property.
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!