Store and recall all appdesigner GUI data.

20 ビュー (過去 30 日間)
Marcel Christian
Marcel Christian 2023 年 3 月 30 日
コメント済み: Rik 2023 年 11 月 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 Center および File ExchangeJSON Format についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by