GUI - Default value of the radio button group

2 ビュー (過去 30 日間)
YIMING
YIMING 2011 年 5 月 21 日
Suppose I have created a button groups which contains 3 radio buttons. What is the default value of this group (i.e., the value that a radio button represents), or how could I set it NULL?

回答 (1 件)

Matt Fig
Matt Fig 2011 年 5 月 21 日
The default should be the first button created.
G = uibuttongroup;
R(1) = uicontrol(G,'style','radio',...
'units','pix',...
'pos',[10 10 40 40]);
R(2) = uicontrol(G,'style','radio',...
'units','pix',...
'pos',[10 80 40 40]);
R(3) = uicontrol(G,'style','radio',...
'units','pix',...
'pos',[10 140 40 40]);
R==get(G,'selectedobject') % Find which one is selected
set(G,'selectedob',[]) % Set to none

カテゴリ

Help Center および File ExchangeApp Building についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by