Store and recall all appdesigner GUI data.

8 次查看(过去 30 天)
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 个评论
Jan Kappen
Jan Kappen 2023-11-30
编辑:Jan Kappen 2023-11-30
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 2023-11-30
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.

请先登录,再进行评论。

回答(1 个)

Dinesh
Dinesh 2023-4-5
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.

类别

Help CenterFile Exchange 中查找有关 Dialog Boxes 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by