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

1 vue (au cours des 30 derniers jours)
Nwasinachi
Nwasinachi le 17 Nov 2022
Commenté : Nwasinachi le 18 Nov 2022
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?

Réponses (1)

Eric Delgado
Eric Delgado le 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 commentaires
Nwasinachi
Nwasinachi le 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?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by