You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Getting inputs from App designer and saving them at a mat file or .mfile
4 views (last 30 days)
Show older comments
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
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
on 18 Nov 2022
So you created a pushbutton for the struct ? I am trying to pull the class objects directly into an array. I have included the code and the app.
lassdef Dummy < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
TabGroup matlab.ui.container.TabGroup
WelcomeTab matlab.ui.container.Tab
TextArea matlab.ui.control.TextArea
TextAreaLabel matlab.ui.control.Label
NEXTButton_4 matlab.ui.control.Button
AgeTab matlab.ui.container.Tab
ListBox matlab.ui.control.ListBox
TextArea2 matlab.ui.control.TextArea
TextArea2Label matlab.ui.control.Label
NEXTButton matlab.ui.control.Button
GenderTab matlab.ui.container.Tab
NEXTButton_2 matlab.ui.control.Button
ListBox_3 matlab.ui.control.ListBox
ListBox_3Label matlab.ui.control.Label
TextArea3 matlab.ui.control.TextArea
TextArea3Label matlab.ui.control.Label
LanguageTab matlab.ui.container.Tab
NEXTButton_3 matlab.ui.control.Button
ListBox_4 matlab.ui.control.ListBox
ListBox_4Label matlab.ui.control.Label
TextArea4 matlab.ui.control.TextArea
TextArea4Label matlab.ui.control.Label
InstructionsTab matlab.ui.container.Tab
NEXTButton_5 matlab.ui.control.Button
TextArea5 matlab.ui.control.TextArea
TextArea5Label matlab.ui.control.Label
TestsoundsTab matlab.ui.container.Tab
NEXTButton_6 matlab.ui.control.Button
PresstoplayButton_2 matlab.ui.control.Button
ButtonGroup_2 matlab.ui.container.ButtonGroup
NOButton_2 matlab.ui.control.RadioButton
YESButton_2 matlab.ui.control.RadioButton
TextArea6_2 matlab.ui.control.TextArea
TextArea6_2Label matlab.ui.control.Label
PresstoplayButton matlab.ui.control.Button
ButtonGroup matlab.ui.container.ButtonGroup
NOButton matlab.ui.control.RadioButton
YESButton matlab.ui.control.RadioButton
TextArea6 matlab.ui.control.TextArea
TextArea6Label matlab.ui.control.Label
Instruction2Tab matlab.ui.container.Tab
Question1Tab matlab.ui.container.Tab
Question2Tab matlab.ui.container.Tab
Question3Tab matlab.ui.container.Tab
Question3Tab_2 matlab.ui.container.Tab
Question4Tab matlab.ui.container.Tab
Question5Tab matlab.ui.container.Tab
FinalpageTab matlab.ui.container.Tab
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
end
% Callback function: NEXTButton_4, WelcomeTab
function ButtonPushed(app, event)
app.TabGroup.SelectedTab = app.AgeTab
end
% Value changed function: ListBox
function ListBoxValueChanged(app, event)
value = app.ListBox.Value;
if strcmp(app.ListBox.Value ,'18-28')||strcmp(app.ListBox.Value ,'29-39')||strcmp(app.ListBox.Value,'40-50')||strcmp(app.ListBox.Value,'51-61')...
||strcmp(app.ListBox.Value,'62-72');
set(app.NEXTButton,'Enable','on');
end
end
% Button pushed function: NEXTButton
function NEXTButtonPushed(app, event)
app.TabGroup.SelectedTab = app.GenderTab
end
% Button pushed function: NEXTButton_2
function NEXTButton_2Pushed(app, event)
app.TabGroup.SelectedTab = app.LanguageTab
end
% Value changed function: ListBox_3
function ListBox_3ValueChanged(app, event)
value = app.ListBox_3.Value;
if strcmp(app.ListBox.Value,'Female')|| strcmp(app.ListBox.Value,'Male')||strcmp(app.ListBox.Value,'Intersex')||strcmp(app.ListBox.Value,'Non-conforming')...
||strcmp(app.ListBox.Value,'Gender-fluid')||strcmp(app.ListBox.Value,'Genderqueer')||strcmp(app.ListBox.Value,'Transgender');
set(app.NEXTButton_2,'Enable','on');
end % simple loop that allows the push button to stay disabled until the person selects an option.
end
% Button pushed function: NEXTButton_3
function NEXTButton_3Pushed(app, event)
app.TabGroup.SelectedTab = app.InstructionsTab
end
% Value changed function: ListBox_4
function ListBox_4ValueChanged(app, event)
value = app.ListBox_4.Value;
if strcmp(app.ListBox.Value ,'One')|| strcmp(app.ListBox.Value ,'Two')|| strcmp(app.ListBox.Value ,'Three')...
|| strcmp(app.ListBox.Value ,'Four')|| strcmp(app.ListBox.Value ,'Polygot');
set(app.NEXTButton_3,'Enable','on');
end
end
% Button pushed function: NEXTButton_5
function NEXTButton_5Pushed(app, event)
app.TabGroup.SelectedTab = app.TestsoundsTab
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.AutoResizeChildren = 'off';
app.UIFigure.Position = [100 100 1116 480];
app.UIFigure.Name = 'MATLAB App';
app.UIFigure.Resize = 'off';
% Create TabGroup
app.TabGroup = uitabgroup(app.UIFigure);
app.TabGroup.AutoResizeChildren = 'off';
app.TabGroup.Position = [1 1 1116 602];
% Create WelcomeTab
app.WelcomeTab = uitab(app.TabGroup);
app.WelcomeTab.AutoResizeChildren = 'off';
app.WelcomeTab.Title = 'Welcome';
app.WelcomeTab.BackgroundColor = [0.502 0.502 0.502];
app.WelcomeTab.ButtonDownFcn = createCallbackFcn(app, @ButtonPushed, true);
% Create NEXTButton_4
app.NEXTButton_4 = uibutton(app.WelcomeTab, 'push');
app.NEXTButton_4.ButtonPushedFcn = createCallbackFcn(app, @ButtonPushed, true);
app.NEXTButton_4.BackgroundColor = [0.3922 0.8314 0.0745];
app.NEXTButton_4.FontSize = 16;
app.NEXTButton_4.FontWeight = 'bold';
app.NEXTButton_4.Visible = 'off';
app.NEXTButton_4.Position = [683 131 100 32];
app.NEXTButton_4.Text = 'NEXT';
% Create TextAreaLabel
app.TextAreaLabel = uilabel(app.WelcomeTab);
app.TextAreaLabel.HorizontalAlignment = 'right';
app.TextAreaLabel.Position = [224 376 55 22];
app.TextAreaLabel.Text = 'Text Area';
% Create TextArea
app.TextArea = uitextarea(app.WelcomeTab);
app.TextArea.FontName = 'Arial Black';
app.TextArea.FontSize = 16;
app.TextArea.FontWeight = 'bold';
app.TextArea.BackgroundColor = [0.502 0.502 0.502];
app.TextArea.Position = [66 131 761 434];
app.TextArea.Value = {''; ''; ''; 'Hello Welcome to my World.'; ''; ''; ''; 'Thank you for particpating in this audio test. There will be a set of questions on the next few screens. '; 'You will not be able to proceed to the next phase without making a selction. '; ''; ''; ''; 'Once again thank you particpating.'};
% Create AgeTab
app.AgeTab = uitab(app.TabGroup);
app.AgeTab.AutoResizeChildren = 'off';
app.AgeTab.Title = 'Age';
app.AgeTab.BackgroundColor = [0.502 0.502 0.502];
% Create NEXTButton
app.NEXTButton = uibutton(app.AgeTab, 'push');
app.NEXTButton.ButtonPushedFcn = createCallbackFcn(app, @NEXTButtonPushed, true);
app.NEXTButton.BackgroundColor = [0.3922 0.8314 0.0745];
app.NEXTButton.FontSize = 16;
app.NEXTButton.FontWeight = 'bold';
app.NEXTButton.Enable = 'off';
app.NEXTButton.Position = [711 162 100 31];
app.NEXTButton.Text = 'NEXT';
% Create TextArea2Label
app.TextArea2Label = uilabel(app.AgeTab);
app.TextArea2Label.BackgroundColor = [0.502 0.502 0.502];
app.TextArea2Label.HorizontalAlignment = 'right';
app.TextArea2Label.Position = [197 470 62 22];
app.TextArea2Label.Text = 'Text Area2';
% Create TextArea2
app.TextArea2 = uitextarea(app.AgeTab);
app.TextArea2.FontName = 'Arial Black';
app.TextArea2.FontSize = 16;
app.TextArea2.FontWeight = 'bold';
app.TextArea2.BackgroundColor = [0.502 0.502 0.502];
app.TextArea2.Position = [40 202 795 300];
app.TextArea2.Value = {'Please choose an age group. You will be unabe to use the next button untill a selection has been made.'; ''; 'This program doesnt allow the user to see the previous page. '; 'So confirm that input is correct.'};
% Create ListBox
app.ListBox = uilistbox(app.AgeTab);
app.ListBox.Items = {'18-28', '29-39', '40-50', '51-61', '62-72', '73-83'};
app.ListBox.ValueChangedFcn = createCallbackFcn(app, @ListBoxValueChanged, true);
app.ListBox.FontName = 'Arial Black';
app.ListBox.FontSize = 16;
app.ListBox.FontColor = [0.3922 0.8314 0.0745];
app.ListBox.BackgroundColor = [0.502 0.502 0.502];
app.ListBox.Position = [40 202 795 169];
app.ListBox.Value = '51-61';
% Create GenderTab
app.GenderTab = uitab(app.TabGroup);
app.GenderTab.AutoResizeChildren = 'off';
app.GenderTab.Title = 'Gender';
app.GenderTab.BackgroundColor = [0.502 0.502 0.502];
% Create TextArea3Label
app.TextArea3Label = uilabel(app.GenderTab);
app.TextArea3Label.HorizontalAlignment = 'right';
app.TextArea3Label.Position = [161 184 62 22];
app.TextArea3Label.Text = 'Text Area3';
% Create TextArea3
app.TextArea3 = uitextarea(app.GenderTab);
app.TextArea3.Editable = 'off';
app.TextArea3.FontName = 'Arial Black';
app.TextArea3.FontSize = 16;
app.TextArea3.BackgroundColor = [0.502 0.502 0.502];
app.TextArea3.Position = [66 148 737 390];
app.TextArea3.Value = {'What gender do you identify as?'; ''; ''; 'You will be unable to use the next button untill a selection has been made.'; 'This program doesnt allow the user to see the previous page. '; 'So confirm that your input is correct.'};
% Create ListBox_3Label
app.ListBox_3Label = uilabel(app.GenderTab);
app.ListBox_3Label.BackgroundColor = [0 0 0];
app.ListBox_3Label.HorizontalAlignment = 'right';
app.ListBox_3Label.FontColor = [0.3922 0.8314 0.0745];
app.ListBox_3Label.Position = [75 328 49 22];
app.ListBox_3Label.Text = 'List Box';
% Create ListBox_3
app.ListBox_3 = uilistbox(app.GenderTab);
app.ListBox_3.Items = {'Female', 'Male', 'Intersex', 'Non-conforming', 'Gender-fluid', 'Genderqueer', 'Transgender'};
app.ListBox_3.ValueChangedFcn = createCallbackFcn(app, @ListBox_3ValueChanged, true);
app.ListBox_3.FontSize = 16;
app.ListBox_3.FontWeight = 'bold';
app.ListBox_3.FontColor = [0.3922 0.8314 0.0745];
app.ListBox_3.BackgroundColor = [0.502 0.502 0.502];
app.ListBox_3.Position = [75 178 728 172];
app.ListBox_3.Value = 'Male';
% Create NEXTButton_2
app.NEXTButton_2 = uibutton(app.GenderTab, 'push');
app.NEXTButton_2.ButtonPushedFcn = createCallbackFcn(app, @NEXTButton_2Pushed, true);
app.NEXTButton_2.BackgroundColor = [0.3922 0.8314 0.0745];
app.NEXTButton_2.FontSize = 16;
app.NEXTButton_2.FontWeight = 'bold';
app.NEXTButton_2.Position = [735 86 100 33];
app.NEXTButton_2.Text = 'NEXT';
% Create LanguageTab
app.LanguageTab = uitab(app.TabGroup);
app.LanguageTab.AutoResizeChildren = 'off';
app.LanguageTab.Title = 'Language';
app.LanguageTab.BackgroundColor = [0.502 0.502 0.502];
% Create TextArea4Label
app.TextArea4Label = uilabel(app.LanguageTab);
app.TextArea4Label.BackgroundColor = [0.502 0.502 0.502];
app.TextArea4Label.HorizontalAlignment = 'right';
app.TextArea4Label.Position = [600 227 62 22];
app.TextArea4Label.Text = 'Text Area4';
% Create TextArea4
app.TextArea4 = uitextarea(app.LanguageTab);
app.TextArea4.Editable = 'off';
app.TextArea4.FontName = 'Arial Black';
app.TextArea4.FontSize = 16;
app.TextArea4.FontWeight = 'bold';
app.TextArea4.BackgroundColor = [0.502 0.502 0.502];
app.TextArea4.Position = [53 162 774 387];
app.TextArea4.Value = {'Language Proficiency'; ''; 'How many languages do you speak?'; ''; 'Please only consider languages that you can speak proficiently and hold a conversation.'; ''; 'Also remember that once you push next you are unable to see this page. Carefully select your anwser. '; ''};
% Create ListBox_4Label
app.ListBox_4Label = uilabel(app.LanguageTab);
app.ListBox_4Label.BackgroundColor = [0.502 0.502 0.502];
app.ListBox_4Label.HorizontalAlignment = 'right';
app.ListBox_4Label.FontColor = [0.3922 0.8314 0.0745];
app.ListBox_4Label.Position = [68 267 49 22];
app.ListBox_4Label.Text = 'List Box';
% Create ListBox_4
app.ListBox_4 = uilistbox(app.LanguageTab);
app.ListBox_4.Items = {'One', 'Two', 'Three', 'Four', 'Polygot'};
app.ListBox_4.ValueChangedFcn = createCallbackFcn(app, @ListBox_4ValueChanged, true);
app.ListBox_4.FontSize = 16;
app.ListBox_4.FontWeight = 'bold';
app.ListBox_4.FontColor = [0.3922 0.8314 0.0745];
app.ListBox_4.BackgroundColor = [0.502 0.502 0.502];
app.ListBox_4.Position = [53 178 774 143];
app.ListBox_4.Value = 'One';
% Create NEXTButton_3
app.NEXTButton_3 = uibutton(app.LanguageTab, 'push');
app.NEXTButton_3.ButtonPushedFcn = createCallbackFcn(app, @NEXTButton_3Pushed, true);
app.NEXTButton_3.BackgroundColor = [0.3922 0.8314 0.0745];
app.NEXTButton_3.FontSize = 16;
app.NEXTButton_3.FontWeight = 'bold';
app.NEXTButton_3.Position = [727 86 100 37];
app.NEXTButton_3.Text = 'NEXT';
% Create InstructionsTab
app.InstructionsTab = uitab(app.TabGroup);
app.InstructionsTab.AutoResizeChildren = 'off';
app.InstructionsTab.Title = 'Instructions';
app.InstructionsTab.BackgroundColor = [0.502 0.502 0.502];
% Create TextArea5Label
app.TextArea5Label = uilabel(app.InstructionsTab);
app.TextArea5Label.BackgroundColor = [0.502 0.502 0.502];
app.TextArea5Label.HorizontalAlignment = 'right';
app.TextArea5Label.Position = [234 326 62 22];
app.TextArea5Label.Text = 'Text Area5';
% Create TextArea5
app.TextArea5 = uitextarea(app.InstructionsTab);
app.TextArea5.FontName = 'Arial Black';
app.TextArea5.FontSize = 16;
app.TextArea5.BackgroundColor = [0.502 0.502 0.502];
app.TextArea5.Position = [53 139 774 386];
app.TextArea5.Value = {'You are going to hear different sounds. '; ''; ''; 'For these test sounds you have to respond with a yes or no. '; ''; ''; 'Please pay attention to the sounds and answer appropiately. '; ''; ''; 'you are allowed to replay the sounds 3 times and then you have to respond.'; ''; ''; 'You must choose a response to be able to proceed to the next screen.'};
% Create NEXTButton_5
app.NEXTButton_5 = uibutton(app.InstructionsTab, 'push');
app.NEXTButton_5.ButtonPushedFcn = createCallbackFcn(app, @NEXTButton_5Pushed, true);
app.NEXTButton_5.BackgroundColor = [0.3922 0.8314 0.0745];
app.NEXTButton_5.FontSize = 16;
app.NEXTButton_5.FontWeight = 'bold';
app.NEXTButton_5.Position = [735 74 100 28];
app.NEXTButton_5.Text = 'NEXT';
% Create TestsoundsTab
app.TestsoundsTab = uitab(app.TabGroup);
app.TestsoundsTab.AutoResizeChildren = 'off';
app.TestsoundsTab.Title = 'Test sounds';
app.TestsoundsTab.BackgroundColor = [0.502 0.502 0.502];
% Create TextArea6Label
app.TextArea6Label = uilabel(app.TestsoundsTab);
app.TextArea6Label.HorizontalAlignment = 'right';
app.TextArea6Label.FontName = 'Arial Black';
app.TextArea6Label.FontWeight = 'bold';
app.TextArea6Label.Position = [196 516 78 22];
app.TextArea6Label.Text = 'Text Area6';
% Create TextArea6
app.TextArea6 = uitextarea(app.TestsoundsTab);
app.TextArea6.FontName = 'Arial Black';
app.TextArea6.FontWeight = 'bold';
app.TextArea6.BackgroundColor = [0.502 0.502 0.502];
app.TextArea6.Position = [40 501 787 37];
app.TextArea6.Value = {'Can you hear this sound?'};
% Create ButtonGroup
app.ButtonGroup = uibuttongroup(app.TestsoundsTab);
app.ButtonGroup.AutoResizeChildren = 'off';
app.ButtonGroup.BackgroundColor = [0.502 0.502 0.502];
app.ButtonGroup.Position = [40 436 184 58];
% Create YESButton
app.YESButton = uiradiobutton(app.ButtonGroup);
app.YESButton.Text = 'YES';
app.YESButton.Position = [11 31 45 22];
app.YESButton.Value = true;
% Create NOButton
app.NOButton = uiradiobutton(app.ButtonGroup);
app.NOButton.Text = 'NO';
app.NOButton.Position = [11 9 40 22];
% Create PresstoplayButton
app.PresstoplayButton = uibutton(app.TestsoundsTab, 'push');
app.PresstoplayButton.BackgroundColor = [1 0.4118 0.1608];
app.PresstoplayButton.Position = [330 466 100 22];
app.PresstoplayButton.Text = 'Press to play';
% Create TextArea6_2Label
app.TextArea6_2Label = uilabel(app.TestsoundsTab);
app.TextArea6_2Label.HorizontalAlignment = 'right';
app.TextArea6_2Label.FontName = 'Arial Black';
app.TextArea6_2Label.FontWeight = 'bold';
app.TextArea6_2Label.Position = [259 354 78 22];
app.TextArea6_2Label.Text = 'Text Area6';
% Create TextArea6_2
app.TextArea6_2 = uitextarea(app.TestsoundsTab);
app.TextArea6_2.FontName = 'Arial Black';
app.TextArea6_2.FontWeight = 'bold';
app.TextArea6_2.BackgroundColor = [0.502 0.502 0.502];
app.TextArea6_2.Position = [40 339 787 37];
app.TextArea6_2.Value = {'Can you hear this sound?'};
% Create ButtonGroup_2
app.ButtonGroup_2 = uibuttongroup(app.TestsoundsTab);
app.ButtonGroup_2.AutoResizeChildren = 'off';
app.ButtonGroup_2.BackgroundColor = [0.502 0.502 0.502];
app.ButtonGroup_2.Position = [40 267 183 62];
% Create YESButton_2
app.YESButton_2 = uiradiobutton(app.ButtonGroup_2);
app.YESButton_2.Text = 'YES';
app.YESButton_2.Position = [11 35 45 22];
app.YESButton_2.Value = true;
% Create NOButton_2
app.NOButton_2 = uiradiobutton(app.ButtonGroup_2);
app.NOButton_2.Text = 'NO';
app.NOButton_2.Position = [11 13 40 22];
% Create PresstoplayButton_2
app.PresstoplayButton_2 = uibutton(app.TestsoundsTab, 'push');
app.PresstoplayButton_2.BackgroundColor = [1 0.4118 0.1608];
app.PresstoplayButton_2.Position = [331 288 100 22];
app.PresstoplayButton_2.Text = 'Press to play';
% Create NEXTButton_6
app.NEXTButton_6 = uibutton(app.TestsoundsTab, 'push');
app.NEXTButton_6.BackgroundColor = [0.3922 0.8314 0.0745];
app.NEXTButton_6.FontName = 'Arial Black';
app.NEXTButton_6.Position = [737 71 100 22];
app.NEXTButton_6.Text = 'NEXT';
% Create Instruction2Tab
app.Instruction2Tab = uitab(app.TabGroup);
app.Instruction2Tab.AutoResizeChildren = 'off';
app.Instruction2Tab.Title = 'Instruction2';
app.Instruction2Tab.BackgroundColor = [0.502 0.502 0.502];
% Create Question1Tab
app.Question1Tab = uitab(app.TabGroup);
app.Question1Tab.AutoResizeChildren = 'off';
app.Question1Tab.Title = 'Question1';
app.Question1Tab.BackgroundColor = [0.502 0.502 0.502];
% Create Question2Tab
app.Question2Tab = uitab(app.TabGroup);
app.Question2Tab.AutoResizeChildren = 'off';
app.Question2Tab.Title = 'Question2';
app.Question2Tab.BackgroundColor = [0.502 0.502 0.502];
% Create Question3Tab
app.Question3Tab = uitab(app.TabGroup);
app.Question3Tab.AutoResizeChildren = 'off';
app.Question3Tab.Title = 'Question3';
app.Question3Tab.BackgroundColor = [0.502 0.502 0.502];
% Create Question3Tab_2
app.Question3Tab_2 = uitab(app.TabGroup);
app.Question3Tab_2.AutoResizeChildren = 'off';
app.Question3Tab_2.Title = 'Question3';
app.Question3Tab_2.BackgroundColor = [0.502 0.502 0.502];
% Create Question4Tab
app.Question4Tab = uitab(app.TabGroup);
app.Question4Tab.AutoResizeChildren = 'off';
app.Question4Tab.Title = 'Question4';
app.Question4Tab.BackgroundColor = [0.502 0.502 0.502];
% Create Question5Tab
app.Question5Tab = uitab(app.TabGroup);
app.Question5Tab.AutoResizeChildren = 'off';
app.Question5Tab.Title = 'Question5';
% Create FinalpageTab
app.FinalpageTab = uitab(app.TabGroup);
app.FinalpageTab.Title = 'Final page';
% Show the figure after all components are created
app.UIFigure.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = Dummy
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
% Execute the startup function
runStartupFcn(app, @startupFcn)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end
Eric Delgado
on 18 Nov 2022
Edited: Eric Delgado
on 18 Nov 2022
Sorry, I'm missing something... do you want to keep the answers to process the data later?! If so...
myStruct = strucr('Age', struct('Items', {'18-28', '29-39', '40-50', 'Selected', '18-28'}), ...
'Gender', struct('Items', {'Female', 'Male', 'Intersex'}, 'Selected', 'Male'), ...
'Language', struct('Items', {'One', 'Two'}, 'Selected', 'One'));
So... for every buttonpushed, you enable the button of the next tab, filling your struct.
You can use the property "Tag" for identify wich radiobuttons is selected and the index of the selected value for listbox.
Nwasinachi
on 18 Nov 2022
I was saying that you have created the struct under a separate push button rather creating one in a the properties and then linking all the push buttons and list box to it
Nwasinachi
on 18 Nov 2022
properties (Access = public)
field1='Age'; value1= {'18-28', '29-39', '40-50', '51-61', '62-72', '73-83'};
field2='Gender'; value2 = {'Female', 'Male', 'Intersex', 'Non-conforming', 'Gender-fluid', 'Genderqueer', 'Transgender'};
field3='Language'; value3={'One', 'Two', 'Three', 'Four', 'Polygot'};
myStruct = struct(field1,value1,field2,value2,field3,value3)
end
I made the change, but still getting an error, field 1 is unrecongized.
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?
See Also
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!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)