防止在matlab中单击单选按钮来取消选中它

发布于 2024-11-19 22:56:11 字数 203 浏览 8 评论 0原文

我使用 GUIDE 创建了 GUI,并将单选按钮放置在一个按钮组面板中。这样可以方便地在单击一个单选按钮时取消选中另一个单选按钮。现在让我感到害怕的是,我实际上可以通过第二次单击已选中的单选按钮来取消选中它,从而使两个单选按钮都处于未选中状态。它适用于其中任何一个。我唯一想要的就是标准的行为,这要求太多了吗……?

我正在使用 Matlab 7.0,不幸的是这就是我所拥有的。

I created GUI using GUIDE and placed to radio buttons in one button-group panel. This conveniently takes care of unchecking one radio button whenever the other one is clicked. Now what's freaking me out is I can actually uncheck a checked radio button by clicking on it a second time, leaving BOTH radio buttons unchecked. It works with either of them. The only thing I want is the standard behavior, is that asking so much....?

I'm using Matlab 7.0, unfortunately this is all I've got.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风情万种。 2024-11-26 22:56:11

我的一台计算机上有 7.0,另一台计算机上有 r2011a,这种非标准行为似乎是他们在两者之间修复的。由于您所拥有的只是 MATLAB 7.0,因此有一个简单的方法来修复它:

在所有单选按钮回调的顶部添加:

if ~get(hObject,'Value')
    set(hObject,'Value',1)
end

这应该可以解决问题。

I have 7.0 on one of my computers and r2011a on another and this non-standard behavior seems to be something that they fixed somewhere in between. Since MATLAB 7.0 is all you have, here is an easy way to fix it:

At the top of all radio button callbacks add:

if ~get(hObject,'Value')
    set(hObject,'Value',1)
end

That should fix the problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文