Getting inputs from App designer and saving them at a mat file or .mfile

1 visualizzazione (ultimi 30 giorni)
I am currently using Tab Group in App designer, and there are several radio button and list boxes that i need the inputs to put into a struct, but i am unsure about how to go about it. Everything i do breaks the App. How do i grab the inputs from the UI via class object?

Risposte (1)

Eric Delgado
Eric Delgado il 18 Nov 2022
Hey... I made an app in R2021b showing how to keep the main info of selected buttongroup and listbox objects. You should use "Tag" property a lot! :)
Hope it's helpful.
app.myStruct = struct('Type', {}, 'ParentTag', {}, 'SelectedObjectText', {});
hObj = [];
for ii = 1:numel(app.Tab.Children)
if ismember(app.Tab.Children(ii).Type, {'uibuttongroup' , 'uilistbox'})
hObj = [hObj; app.Tab.Children(ii)];
end
end
for ii = 1:numel(hObj)
switch hObj(ii).Type
case 'uibuttongroup'
selected = hObj(ii).SelectedObject.Text;
case 'uilistbox'
selected = hObj(ii).Value;
end
app.myStruct(end+1) = struct('Type', hObj(ii).Type, ...
'ParentTag', hObj(ii).Tag, ...)
'SelectedObjectText', selected);
end
  6 Commenti
Nwasinachi
Nwasinachi il 18 Nov 2022
i have created an empty struct in the properties. i am assuming that was the change you made to the last code.
i guess my question now is would the struct be included in each buttons call back? that i need to save the information for?

Accedi per commentare.

Categorie

Scopri di più su Migrate GUIDE Apps 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!

Translated by