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

1 回表示 (過去 30 日間)
Nwasinachi
Nwasinachi 2022 年 11 月 17 日
コメント済み: Nwasinachi 2022 年 11 月 18 日
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?

回答 (1 件)

Eric Delgado
Eric Delgado 2022 年 11 月 18 日
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 件のコメント
Eric Delgado
Eric Delgado 2022 年 11 月 18 日
Ok. See app attached.
Nwasinachi
Nwasinachi 2022 年 11 月 18 日
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?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by