jeudi 9 février 2023

Matlab GUI checkbox enable or disable

I am trying to work with a GUI in MATLAB which once run, would first read through a MATLAB struct, for example, abc.checkboxStatus, having values of 1 or 0 based on earlier user input, and will load the GUI with the checkbox enabled or disabled, based on the previously saved information, i.e., whether earlier, the checkbox was enabled or disabled. Now I would also like it to be flexible for future alterations, meaning that I should be able to enable or disable the checkbox later as well and based on its latest input, the information will be saved in the abc.checkboxStatus struct.

In easier language, if today, I enabled the checkbox, the abc.checkboxStatus should store the value 1, and when I run the GUI tomorrow, it should open with the checkbox ticked. If tomorrow, I want to disable the checkbox, this info should be stored in the abc.checkboxStatus, that is abc.checkboxStatus would be equal to 0, and when I load the GUI the day after tomorrow, it should open with the checkbox unticked.

Any input is greatly appreciated. Thanks!

**I am currently unable to read through the abc.checkboxStatus and set the checkbox in the GUI accordingly. I am using the code

set(hObject,'Value',abc.checkboxStatus)

but this does not allow to alter the checkbox status later, it gets fixed to either 0 or 1, so I need help with this.**




Aucun commentaire:

Enregistrer un commentaire