简体   繁体   English

在Matlab GUI中编辑复选框

[英]Editing checkboxes in a Matlab GUI

Using the GUI guide editor in Matlab 2008b, I have run into a problem with check boxes. 使用Matlab 2008b中的GUI指南编辑器,我遇到了复选框问题。 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). 我的问题是我有一个按钮可以重置GUI中的所有内容(编辑图片)。 However, there are checkboxes in my GUI and I can't figure out how to deselect these checkboxes when the reset button is pressed. 但是,我的GUI中有复选框,按下复位按钮后,我不知道如何取消选择这些复选框。

Additional: The actions that the checkboxes perform are already reset, I just need to get the check in the box to be reset 附加:复选框执行的操作已重置,我只需要选中复选框即可重置

For unselecting checkboxes, set the 'Value' property to 0 (or whatever the 'Min' property is set to, if you changed it). 对于取消选择复选框,请将“值”属性设置为0(或将“最小”属性设置为的任何值,如果您将其更改)。 It would look like: 它看起来像:

set(hCheck1,'Value',0);
%OR
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). 在这里, hCheck1是第一个复选框的句柄(我认为如果在GUIDE中创建GUI,则可以从句柄结构中获取)。 You would then repeat this for each of the other two checkboxes. 然后,您将对其他两个复选框重复此操作。 If a checkbox is already unchecked, the above will have no effect. 如果未选中该复选框,则以上内容无效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM