Matlab – Editing checkboxes in a Matlab GUI


Using the GUI guide editor in Matlab 2008b, I have run into a problem with check boxes. I have looked at numerous online tutorials and such but haven't found a solution. My problem is that I have a button that resets everything in the GUI (editing a picture). However, there are checkboxes in my GUI and I can't figure out how to deselect these checkboxes when the reset button is pressed.

Additional: The actions that the checkboxes perform are already reset, I just need to get the check in the box to be reset

Best Solution

For unselecting checkboxes, set the 'Value' property to 0 (or whatever the 'Min' property is set to, if you changed it). It would look like:

set(hCheck1,'Value',get(hCheck1,'Min'));  % If 'Min' is something besides 0

Here, hCheck1 is the handle of the first checkbox (which I think you can get from the handles structure if creating your GUI in GUIDE). You would then repeat this for each of the other two checkboxes. If a checkbox is already unchecked, the above will have no effect.

Related Question