reference objects outside function workspace?
5 次查看(过去 30 天)
显示 更早的评论
I have a simulation. It is run by a timer; the time function notifies a bunch of objects of an event, and in their callback functions they update themselves and produce xml strings. I want to send all the xml to a socket in the same function that produces the xml. If i put the socket in the workspace and then these functions run, is there a way for them to use the socket even though it isn't in the scope of the function?
0 个评论
采纳的回答
Walter Roberson
2011-8-12
Yes. You could create an access method for it, or you could findobj() on it, or you could create a global variable, or you could use any of the techniques used to share data with graphic callbacks (see http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.3F)
or you could pass the object handle in to the timer callback, or ...
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Properties 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!