TL:DR I was handed off code I want to update into an app designer that uses a GUI as inputs to a follow up function and am not grasping how to have the GUI talk to outside code and am asking for help on a basic example.
Background - I know this question has been answered a few times on here. But i am still lost as the examples are a bit to high level for me. I have been using matlab for almost 10 years now but only in the basic editor. Additionally, it is the only coding language I know.
I was handed some code from a previous individual that hand coded a GUI. Example:
Signal_Title = uicontrol(Settings_LP,'Style','text',...
'String','Signal Analysis Setup',...
'Units','normalized',...
'Position',[GUI_Spacing_W,1-(S1B_Title_H+GUI_Spacing_H),S1B_Title_W*2,S1B_Title_H],...
'Fontsize',Main_Title_Font);
height_1 = 1-(S1B_Title_H+GUI_Spacing_H);
etc etc and it goes on for 1000 lines of code to create:
Each checkbox is an initial condition that will be used in a following funciton.
I wanted to update this do app designer and I have been struggling. I was able to build the figure to look exactly the same but I am struggling with getting the outputs to be controlled by the GUI.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
So I wanted to break this down to a fundamenatals question. I want this check mark to interact with an outside function.
I wrote the worlds simplest code.
function checkboxer(inputArg1)
if inputArg1 == 1;
figure
end
end
The intention was to be when the GUI closes. if the box is checked. just poplulate an emply figure. and if the box is not checked. do nothing. I have been trying to get this moving for almost 3 days but I struggle with undestanding classes, properties, callbacks etc and none of the YT videos or forum posts have helped me brigde the gap.
classdef checkboxtester < matlab.apps.AppBase
properties (Access = public)
UIFigure matlab.ui.Figure
Check1CheckBox matlab.ui.control.CheckBox
end
properties (Access = public)
Check1 = 1;
end
methods (Access = public)
function appdesignfunction(app)
checkboxer(app.Check1)
end
end
methods (Access = private)
function Check1CheckBoxValueChanged(app, event)
value = app.Check1CheckBox.Value;
if value == 1
app.Check1 = 1;
end
end
end
This is the current appdesigner code. Following along a few of the posts I made the outer function a function in app designer, and then to be honest I dont have a clue how properties work or how to call the section of the value. I have been struggling on this basic case but I feel like if I get it explanded in basic terms I should be able to brigde the gap.