save handles in GUI

14 vues (au cours des 30 derniers jours)
Minghua Li
Minghua Li le 17 Mar 2013
Hi everyone,
I am doing GUI design using GUIDE, and I want to create 'Save' and 'Load' button on my interface, 'Save' button could save the values of all the widgets, like value of radio button, string of textbox,etc. 'Load' button could retrieve them all after reopen the GUI. Is there anyway to do this? To save them all at one time?
Thanks,
Minghua

Réponses (2)

Walter Roberson
Walter Roberson le 18 Mar 2013
You might be able to do something with hgsave()

Jan
Jan le 18 Mar 2013
Yes, you can save them all at one time. At first get all the required values and then save it as a struct. E.g. get all children by findobj(), create a loop which obtains all tags and values for objects, which have a 'Value' property. Then store the list of tags and the values as a cell. Finally save it as MAT file e.g. in the prefdir folder.
Loading is equivalent: Load the struct, search the tags are assign the values.

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by