Filter löschen
Filter löschen

How to link Radio button and Push button (Matlab GUI)

1 Ansicht (letzte 30 Tage)
Abraham Chan
Abraham Chan am 5 Apr. 2015
Beantwortet: Ali Noori am 25 Jun. 2015
When handles.radiobutton1 is selected then
user click the Push button the code is executed.
How to implement this? see attach file

Akzeptierte Antwort

Geoff Hayes
Geoff Hayes am 5 Apr. 2015
Abraham - the easiest way to implement this GUI is through GUIDE using a callback for the push button. See the tutorials that can be found here.
  2 Kommentare
Abraham Chan
Abraham Chan am 5 Apr. 2015
Yeah i know that.I dont know how to link Radio button and Push button
Geoff Hayes
Geoff Hayes am 5 Apr. 2015
Abraham - use the handles structure which is the third input to the push button callback as it has (at the least) the handles to all controls used in your GUI. For example,
function pushbutton1_Callback(hObject, eventdata, handles)
if get(handles.radiobutton1,'Value')
% do something
else
% do something else
end

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Ali Noori
Ali Noori am 25 Jun. 2015
To link between push button and radio button, do like this:
function pushbutton1_Callback(hObject, eventdata, handles)
if get(handles.radiobutton1,'Value') your function % do something end if get(handles.radiobutton2,'Value') your function % do something else end if get(handles.radiobutton3,'Value') your function %do someething else end end

Ali Noori
Ali Noori am 25 Jun. 2015
To link between push button and radio button, see attached file:

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