reference objects outside function workspace?
5 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Walter Roberson
on 12 Aug 2011
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 ...
More Answers (0)
See Also
Categories
Find more on Graphics Object Properties in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!