display extra value in datacursor
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Is there a way to add other values to the datacursor? So besides x and y.
I have an array with x and y values and a value d. Now I like to see value d of the selected point in the datacursor.
0 Kommentare
Antworten (1)
Zikobrelli
am 12 Jun. 2014
Data cursor has a callback function that can be found like this: on your plot: 1)click on the data cursor 2)Right click on the plot 3)Edit text Update function
You should get smthg like this: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%ù 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'); output_txt = {['X: ',num2str(pos(1),4)],... ['Y: ',num2str(pos(2),4)]};
% If there is a Z-coordinate in the position, display it as well if length(pos) > 2 output_txt{end+1} = ['Z: ',num2str(pos(3),4)]; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4)you can add more info/values and then save function to workspace
Cheers,
0 Kommentare
Siehe auch
Kategorien
Mehr zu Axis Labels finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!