Best practice for saving and loading axes children from and to an app designer axes?

5 ビュー (過去 30 日間)
Kristoffer Walker
Kristoffer Walker 2023 年 2 月 22 日
編集済み: Kristoffer Walker 2023 年 2 月 22 日
I have an app created in app designer. It has 3 GUI windows. The master window declares a public data container, which is subsequently written to by two slave windows. Each slave window has several figure axes. On closing of a slave window, I would like to save the slave figure axes objects to the master data container such that when the slave window is opened again, I repopulate the slave window figure axes exactly as they were before. What would be convenient of course is something like this for save:
app.MasterCallingApp.Slave1Data.axes1 = app.UIAxes1;
and something like this for loading:
app.UIAxes1 = app.MasterCallingApp.Slave1Data.axes1;
What is the best practice for how to accomplish this? I did a bit of searching and landed on some leads, but I tried some of them without success, and others look too complicated for me to consider.
Thank you for your help!
  2 件のコメント
chrisw23 2023 年 2 月 22 日
try to pass your handles/data by the app constructor...see App Input Arguments
Kristoffer Walker
Kristoffer Walker 2023 年 2 月 22 日
Thanks for the reply. Yes, that is how the axes data gets back and forth between the master (what saves it to disk) and slave (what plots it in its axes). CallingApp is the argument name. That is not the question I'm trying to ask. My question is about a convenient way to store the axes objects and then redisplay them again in the future when the window is swawned again.


回答 (1 件)

Timo Dietz
Timo Dietz 2023 年 2 月 22 日
編集済み: Timo Dietz 2023 年 2 月 22 日
I'm using setappdata/getappdata for things like this.
You can store/get arbitrary data (structs, objects, ...) e.g. to an app or figure, accessible via a name you can freely define.
  1 件のコメント
Kristoffer Walker
Kristoffer Walker 2023 年 2 月 22 日
編集済み: Kristoffer Walker 2023 年 2 月 22 日
Thansk for the reply. I need to explore this idea. It is not clear to me how to use it in app designer space.



Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索




Community Treasure Hunt

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

Start Hunting!

Translated by