Filter löschen
Filter löschen

store value of selected radio button from group button

4 Ansichten (letzte 30 Tage)
fatemeh
fatemeh am 21 Dez. 2013
Kommentiert: Walter Roberson am 23 Aug. 2018
i want get the value of selected radio button from button group i use this code:
u=get(handles.uipanel12,'SelectedObject');
but this code get me a number while the object is a string.(name and tag of radio button)
can u help me?
thanks

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 21 Dez. 2013
Bearbeitet: Walter Roberson am 21 Dez. 2013
u = get(get(handles.uipanel12,'SelectedObject'), 'Value');
  7 Kommentare
Sumera Yamin
Sumera Yamin am 23 Aug. 2018
@ Walter Roberson Is it possible to set values of subsequent radio buttons to '3' and '4' ? So that when i select third or fourth radio buttons, only code relevant to that part is executed?
Walter Roberson
Walter Roberson am 23 Aug. 2018
The Value property of a button will be equal to the button's Min property if the button is not selected, and equal to the button's Max property if the button is selected.
So you could set the buttons to have 'Max', 1 for the first button, 'Max', 2 for the second, 'Max' 3 for the third, and so on. Then the Value property of the current button would tell you which of the buttons had been selected.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by