function pushbutton1_Callback(hObject, eventdata, handles)
5 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
Azzi Abdelmalek
2013-3-3
编辑:Azzi Abdelmalek
2013-3-3
In function pushbutton1_Callback you should update your handles
handles.metricdata.a=1;
guidata(hObject,handles)
5 个评论
Azzi Abdelmalek
2013-3-3
编辑:Azzi Abdelmalek
2013-3-3
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!