Handling external variables when redefining the text displayed by the data cursor
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello everyone,
I would like to customize a matlab example defined to modify the text defined by the data cursor. The purpose is to make the data cursor dispay information that differs from its position.
The original scritp mainly looks like: fig= figure; dcm_obj = datacursormode(fig); set(dcm_obj,'UpdateFcn',@myupdatefcn)
My point is that I want to add input to the function handled by @myupdatefcn but I do not know how to call this input within the set command. Maybe it is trivial and I do not have the right keywords to check. Does someone have an idea? Many thanks in advance
0 Kommentare
Antworten (1)
Jordy Jose
am 31 Jan. 2018
hi Isabelle,
You may pass additional arguments like this:
val = 10;
set(dcm_obj,'UpdateFcn', {@myupdatefcn, val});
For more details regarding callback definitions, please refer to the link below:
https://www.mathworks.com/help/matlab/creating_plots/callback-definition.html
The function definition for myupdatefcn will look something like this:
function out = myupdatefcn(src, evt, val)
%your code here: val will be equal to 10
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Whos 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!