Radio button status call in Push Button matlab gui
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Snowleopard
am 30 Jul. 2016
Beantwortet: Image Analyst
am 30 Jul. 2016
I have 2 Radio buttons R1,R2 & two Push Buttons PB1, PB2. Either R1 or R2 can be selected when R1 is selected it uploads few image mat files in PB2 & when PB2 is pressed it processes the images. Similarly when R2 is selected it loads few different mat files to PB2 but now PB1 can be used by user. When R1 is selected PB1 can't be used.
Here R1 is related to PB2 only
R2 is related to PB1 & PB2
function pushbutton1_Callback(hObject, eventdata, handles)
if get(handles.R1,'Value')
% load 4 mat files
end
if get(handles.R2,'Value')
% load 5 mat files
end
Can anyone please help me with
- How we can ensure that only one radio button is selected at a time.
- above code is not working, point mistake or improve it.
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 30 Jul. 2016
In GUIDE, you can create a panel that is a button group. Put your radio buttons inside of that. If you do that, it will automatically take care of toggling the radio buttons so that only one is "true" and the others are all false/off. In your pushbutton callbacks, you can still get the values of the radio buttons, like
if handles.R1.Value
% load 4 mat files
end
Like you said.
0 Kommentare
Weitere Antworten (1)
Walter Roberson
am 30 Jul. 2016
See uibuttongroup()
Also, to disable a button, set() its 'enable' property to 'off'
0 Kommentare
Siehe auch
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!