When I use the Data Cursor option on a plot, I am able to view the X and Y-coordinates on the tool tip. However I wish to see the index of that point. I have tried editing the textUpdate function as follows:
function output_txt = myfunction(obj,event_obj)% Display the position of the data cursor
% obj Currently not used (empty)
% event_obj Handle to event object
% output_txt Data cursor text string (string or cell array of strings).
pos = get(event_obj,'Position');x = pos(1); y = pos(2);idx = find(xydata == x,y);[row,~] = ind2sub(size(xydata),idx);output_txt{end+1} = cell2mat(labels(row));
However this gives an error. Does anyone have any suggestions?
Thanks in advance
Deepa
Best Answer