Hello,
I am currently trying to update a static text box in a MATLAB GUI I made. I am fairly new to GUIs, and I tried creating addlisteners, but to no avail.
I pre-set checkboxes in the opening function, and I want to be able to display the amount of boxes that are checked into a static text box . I have:
- checkbox1 – checked
- checkbox2 – not checked
- checkbox3 – checked
- checkbox4 – checked
- checkbox5 – checked
I would like the static text box to display "4", and if I select the last checkbox, or deselect another checkbox, I would like the value to dynamically change.
% main loop
% --- Executes just before PnP_GUI is made visible.
function PnP_GUI_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to PnP_GUI (see VARARGIN)
% Choose default command line output for PnP_GUI
handles.output = hObject;%Pre-Check Save Options
set(handles.checkbox1,'value',1)%set(handles.checkbox2,'value',0) % want not checked to start
set(handles.checkbox3,'value',1)set(handles.checkbox4,'value',1)set(handles.checkbox5,'value',1)% Update handles structure
guidata(hObject, handles);
Any help would be greatly appreciated.
Thank you,
– JR
Best Answer