How do I pass variables from one function to another in MATLAB GUIDE GUI's?
3 views (last 30 days)
Show older comments
I have a GUI with two buttons.
I define a variable, A, in the first button when loading a file. I need access to that variables value in the callback for the second button.
Is there a way to pass this without using a global variable or putting it in the handles structure with GUIDATA function?
0 Comments
Accepted Answer
Doug Hull
on 13 Jun 2011
This video helps you with the commands you need (getappdata, setappdata) http://blogs.mathworks.com/videos/2005/10/03/guide-video-part-two/ http://www.mathworks.com/help/techdoc/ref/getappdata.html http://www.mathworks.com/help/techdoc/ref/setappdata.html
Here is the documentation on scope of variables. http://www.mathworks.com/help/techdoc/matlab_prog/bresuxt-1.html
More Answers (1)
Image Analyst
on 14 Jun 2011
See the FAQ for several ways to do it: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.3F
0 Comments
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!