Pass variables into set(frt,'WindowButtonDownFcn',@mousePos)
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2012-7-15
编辑:Walter Roberson
2012-7-15
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.
更多回答(1 个)
Xiangqi
2013-8-27
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Other Formats 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!