DataCursormode - Selecting Points on Graph

I attempted to implement this idea:
However, suppose I want to limit the mouse clicks to a variable
function pick_Callback(hObject, eventdata, handles)
pick = handles.pick %Pick could be any random number
dcm_obj = datacursormode(figure (8));
set(dcm_obj,'DisplayStyle','datatip',...
'SnapToDataVertex','off','Enable','on')
c_info = getCursorInfo(dcm_obj);
if(numel(c_info)==numel(pick))
set(dcm_obj,'Enable','off');
end
For some reason, it allows me to continue selecting points. I want it to stop at numel(pick).

 Réponse acceptée

T
T le 13 Août 2013
Or suppose I use
[x,y] = ginput(number)
Suppose further that a button initiates this action but the figure appears in a separate window.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Question posée :

T
T
le 13 Août 2013

Community Treasure Hunt

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

Start Hunting!

Translated by