Run a function when a GUI fig is opened?
Show older comments
Is it possible to automatically run a function when a GUI (fig) is opened? I.e. is there a property of the fig class that would do this? I would like to construct the controls differently depending on the environment, e.g. Windows vs. Linux, which specific files are in the system search path, etc. Thanks, Campbell
Accepted Answer
More Answers (1)
Jakob Sørensen
on 4 May 2012
0 votes
You can run it through the GUI opening function, or do you mean for any figure which is opened?
3 Comments
Campbell
on 4 May 2012
Walter Roberson
on 4 May 2012
Is this for GUIDE? GUIDE .fig files are not designed to be used independently of the .m file of the same name. The .m file contains a GUI open function, which is the place that you would normally put a call to the routine to make OS-specific adjustments.
.fig files that contain code are not designed to run any function when they are opened.
Jakob Sørensen
on 5 May 2012
Normally what you do is make a GUI (using Guide), which can be run by typing its name in the command prompt (assuming that you're in the correct folder). Once in the GUI, you're free to make controls for almost everything...
Categories
Find more on Interactive Control and Callbacks 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!