The code is actually refered from a previous thread, where it is still functional with some warnings. Maybe it's because of a different version?
Unable to save/load objects (uitree uitable) created by App designer ? (R2019a)
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi, I'm using App Designer to build an app with a uitree and a uitable. The tree/table is editable in the app during runtime. I want the edited tree/table to be saved to a local place, and also be able to be loaded in the future. So I created the save/load buttons to save/load the uitree/uitable as the following (Tree as example):
function Button_Save(app, event) % save the app.Tree to TreeSave.mat
ProgramTree=app.Tree;
uisave('ProgramTree','TreeSave')
end
function Button_Load(app, event) % load and assign
ProgramTree= load('TreeSave.mat');
app.Tree=ProgramTree;
end
But there are warning "Unable to save/load the object created by App designer" and error "Invalid data type. The data type must be matlab.ui.container.Tree or can be converted to matlab.ui.container.Tree", and the load function is not working. It seems Matlab has banned the save/load function for objects created by Appdesigner. I'm wondering if there is a way to walk around this, or is there anyway to extract the information of uitree to some other type of file, maybe .xls, for reuse? Thank you for reading.
3 Commenti
Risposte (1)
Inso
il 25 Ott 2019
1 Commento
Vaibhav Deshmukh
il 1 Mag 2024
Modificato: Vaibhav Deshmukh
il 1 Mag 2024
Last line of code actually assigns the loaded tree (f) to the app. I would've expected the code to be
app.Tree= f.Parent
but it is the opposite. Thanks for this explanation. Very helpful.
Vedere anche
Categorie
Scopri di più su Environment and Settings in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!