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

1 view (last 30 days)
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?

Answers (1)

Eric Delgado
Eric Delgado on 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 Comments
Nwasinachi
Nwasinachi on 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?

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!