This is what I tried:
function checkbox1_Callback(hObject, eventdata, handles)
% hObject handle to checkbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of checkbox1
S5.checkboxStatus = get(h.checkbox1,'Value');
set(handles.checkbox1,'UserData', S5);
and in my figures:
if S5.checkboxStatus==1
figure(1);
else
figure ('Visible','off');
But this giving me error:
Attempt to reference field of non-structure array.