Set Data Cursor Text Update Function in GUIDE GUI
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Gregory McFadden
am 14 Mär. 2017
Beantwortet: Adam
am 14 Mär. 2017
I suspect I am just missing something very simple, but I am confused how I set the data cursor text update function in a GUIDE generated GUI. I have the standard menu bar turned on, showing the data cursor button.
0 Kommentare
Akzeptierte Antwort
Adam
am 14 Mär. 2017
Assuming you didn't change the 'tag' of your GUIDE-created figure (I always change min), you can just do
dcm = datacursormode( handles.figure1 );
dcm.UpdateFcn = @updateDataCursor;
and then define updateDataCursor in the file as
function outputText = updateDataCursor(~,event_obj)
where event_obj has fields 'Target' and 'Position' which you can use to create outputText, for example one I did uses the following:
pos = get( eventObj, 'Position' );
outputTxt = { ['R: ', num2str( round( pos( 1 ), 3 ) )],...
['G: ', num2str( round( pos( 2 ), 3 ) )],...
['B: ', num2str( round( pos( 3 ), 3 ) )] };
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Environment and Settings finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!