matlab GUI 中,if -----text1的'visible'属性是'on----属性条件语句的编写
matlabGUI中,pushbutton1中set(handles.text1,'visible','on');在pushbutton2中如何编写函数:if-----t...
matlab GUI 中,pushbutton1中set(handles.text1,'visible','on');在pushbutton2中如何编写函数:if -----text1的'visible'属性是'on'-----,pushbutton2 call back就设置set(handles.text2,'visible','on').。。。。即按下一个按钮显示一个文本,再按下第二个按钮根据条件有选择的显示另一个文本。谢谢~
展开
1个回答
展开全部
function pushbutton1_Callback(hObject, eventdata, handles)
h1=findobj(handles.text1,'visible','off')%获取按键1的可视化句柄
set(h1,'visible','on')%设置句柄为可见
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
h2=findobj(handles.text1,'visible','on')%再次获得按键1句柄
m1=findobj(handles.text2,'visible','off')%获得按键2的句柄
%m2=findobj(handles.text2,'visible','on')
if h2==findobj(handles.text1,'visible','on')%判断句柄值是否为可视
set(m1,'visible','on')%如果是,将按键2句柄值改为可视
else%如果不是,添加语句
end
%前提是两个text的’visible‘为off我已经试过了,你试试
h1=findobj(handles.text1,'visible','off')%获取按键1的可视化句柄
set(h1,'visible','on')%设置句柄为可见
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
h2=findobj(handles.text1,'visible','on')%再次获得按键1句柄
m1=findobj(handles.text2,'visible','off')%获得按键2的句柄
%m2=findobj(handles.text2,'visible','on')
if h2==findobj(handles.text1,'visible','on')%判断句柄值是否为可视
set(m1,'visible','on')%如果是,将按键2句柄值改为可视
else%如果不是,添加语句
end
%前提是两个text的’visible‘为off我已经试过了,你试试
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询