Programatically add OpeningFcn in GUI
Show older comments
Hi,
I have programatically created a GUI app using a single function file (e.g. mygui.m) and putting all my code in that single file. Now I need to add an OpeningFcn in that code. Where and how should I add that OpeningFcn in my code so that I can add data in handles variable in that OpeningFcn to access it later in my other functions?
Thanks
4 Comments
Kevin Chng
on 23 Oct 2018
What does it mean?
programatically created a GUI app
Are you use GUIDE, app designer or programmically GUI?
if programically GUI, it is quite flexible, you may insert a function after you declare all the relevant components. The function can be your OpeningFcn.
Haider Ali
on 23 Oct 2018
Edited: Haider Ali
on 23 Oct 2018
Kevin Chng
on 24 Oct 2018
Edited: Kevin Chng
on 24 Oct 2018
Using handles to pass data is what we favour to do in GUIDE Gui.
I guess it should be also workable in programmically GUI. There is some knowledge require to structure the object and handle in your GUI like what we will see in GUIDE Gui (Guide generate it automatically).
Hence, I will recommend you use global to pass your data.
Walter Roberson
on 24 Oct 2018
Don't use global!
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects 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!