使用Matlab,在GUI中使用radiobutton隐藏edittext和静态文本

时间:2015-01-09 14:33:47

标签: matlab radio-button matlab-guide

这里我的列表隐藏静态文本并在gui中编辑文本,但它不起作用

function uipanel1_CreateFcn(hObject, eventdata, handles)   
    switch get(eventdata.NewValue,'Tag')
        case radiobutton1
            set(handles.text5, 'Visible', 'On');
            set(handles.edit4, 'Visible', 'On');
        case radiobutton2
            set(handles.text5, 'Visible', 'Off');
            set(handles.edit4, 'Visible', 'Off');
        case radiobutton3
            set(handles.text5, 'Visible', 'Off');
            set(handles.edit4, 'Visible', 'Off');
    end

告诉我上市的错误

1 个答案:

答案 0 :(得分:-1)

radiobutton(tag)=get(hObject,'Value');
if radiobutton(tag)
    set(handles.edittext,'Enable','off')
    set(handles.statictext,'Enable','off')
else
    set(handles.edittext,'Enable','on')
    set(handles.statictext,'Enable','on')
end
guidata(hObject,handles);