Clear Filters
Clear Filters

Store and recall all appdesigner GUI data.

19 views (last 30 days)
Marcel Christian
Marcel Christian on 30 Mar 2023
Commented: Rik on 30 Nov 2023
Hi,
I have a larger GUI designed with Appdesigner (.mlapp) with many components such as text fields, sliders, tables, graphs, edit fields... I need to store the whole state of the GUI when selected by the user (Save state to file) and restore later (Load state from file). I found a lot of workarounds where they basically iterate through every object and one by one save it to a .mat file and later reload the whole data, but since the GUI will be growing and its already hundreds of values, I'd love to know if there is any way to store it all at once. Something like save(app) and load(app). Basically a copy of all the internal variables.
Best would be to have it in a human readable file like XML, but that would be just the cherry to the icecream.
  5 Comments
Jan Kappen
Jan Kappen on 30 Nov 2023
Edited: Jan Kappen on 30 Nov 2023
Our company does have a NDA signed with Mathworks. Who would I have to contact for such kinds of information?
I see the workaround, but I'm hoping for a more straight forward way. Iterating manually through all ui elements does not feel right. Maybe there's a way using findall and iterate through the different ui component types - but even then we'd need to know which properties have to be saved. We would need to create a list for each component type which properties are important.
Or the full component gets just saved to mat. I just tried that out using a button. It loses its Parent property, but after reassigning it, it works again. Not sure if that works for all UI elements of course.
Rik
Rik on 30 Nov 2023
I would personally just store the value property, but whatever works for you.
As for who to contact: you should either open a support ticket, or contact the Mathworks representative who was involved with the NDA.

Sign in to comment.

Answers (1)

Dinesh
Dinesh on 5 Apr 2023
Hi Marcel.
No, MATLAB doesn't support saving/loading the app state to/from an XML file.
If you are considering using JSON format to save and retreive data, the following toolbox might help you:
You can write a custom script along with this JSONLab toolbox to achieve what you wanted. JSONLab toolbox provides savejson() and loadjson() functions. But, you would need to write your own functions to retrieve all the properties in your app and then create a JSON object out of it for the "save" functionality and the vice-versa for the "load" functionality.

Categories

Find more on Dialog Boxes in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!