Filter löschen
Filter löschen

function pushbutton​1_Callback​(hObject, eventdata, handles)

32 Ansichten (letzte 30 Tage)
function pushbutton1_Callback(hObject, eventdata, handles)
handles.metricdata.a=1;
function pushbutton2_Callback(hObject, eventdata, handles)
b=handles.metricdata.a;
if(b~=1)
msgbox('ok');
end
if(b==1)
msgbox('false');
end
in above code, if i don't press pushbutton1 and i press pushbutton2 then message 'ok' should display and if i press pushbutton1 and i press pushbutton2 then message 'false' should display.

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 3 Mär. 2013
Bearbeitet: Azzi Abdelmalek am 3 Mär. 2013
In function pushbutton1_Callback you should update your handles
handles.metricdata.a=1;
guidata(hObject,handles)
  5 Kommentare
Azzi Abdelmalek
Azzi Abdelmalek am 3 Mär. 2013
Bearbeitet: Azzi Abdelmalek am 3 Mär. 2013
In your yourfilename_OpeningFcn
handles.metricdata.a=0;
guidata(hObject,handles)
In
function pushbutton1_Callback(hObject, eventdata, handles)
handles.metricdata.a=1;
guidata(hObject,handles)
In
function pushbutton2_Callback(hObject, eventdata, handles)
b=handles.metricdata.a;
if(b~=1)
msgbox('ok');
end
if(b==1)
msgbox('false');
end

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by