Pass variables into set(frt,'WindowButtonDownFcn',@mousePos)
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Quick question, how can i pass some other variables that i want in mousePos
function mousePos(hObject,~)
mPos=get(hObject,'CurrentPoint');
finalPos(mPos,data)
The data variable is defined in the main function but i want to use it here too.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 15 Jul. 2012
Bearbeitet: Walter Roberson
am 15 Jul. 2012
set(frt, 'WindowButtonDownFcn', {@mousePos, data} )
and
function mousePos(hObject, ~, data)
Note: this will use the value of "data" as of the time the callback is created, and will not reflect any updates to "data" that are made after that.
3 Kommentare
Weitere Antworten (1)
Xiangqi
am 27 Aug. 2013
To Raldi,
Hi~ Have you found the way to update the value of "data" ?
I encountered the same problem and don't know how to update it.
Thanks for your help in advance.
Huang
0 Kommentare
Siehe auch
Kategorien
Mehr zu Other Formats 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!