MatLab单选按钮功能

时间:2014-11-16 17:44:13

标签: matlab radio-button

我有两个连接到文本路径的单选按钮,因此当我按下任一单选按钮时,我试图清除文本路径。这是我的代码所以:

%initialise the radio button
set(handles.nefFile,'Value',1)
set(handles.tiffFile,'Value',0)

% --- Executes on radio button press in .NEF.
function nefFile_Callback(hObject, eventdata, handles)
    if get(handles.hObject,'Value')
        set(handles.file1Path,'',text)
        set(handles.file2Path,'',text)
    else
        set(handles.file1Path,'String',text)
        set(handles.file2Path,'String',text)
    end
guidata(hObject,handles);

% --- Executes on radio button press in .TIFF.
function tiffFile_Callback(hObject, eventdata, handles)

end

1 个答案:

答案 0 :(得分:0)

替换

set(handles.file1Path,'',text)
set(handles.file2Path,'',text)

set(handles.file1Path,'String','')
set(handles.file2Path,'String','')