MATLAB下标索引必须是实数正整数或逻辑

时间:2013-11-20 14:44:19

标签: matlab matlab-figure

我不知道代码有什么问题。这是片段。

function popFreqResp_Callback(hObject, eventdata, handles)
list=get(handles.popFreqResp,'String');
str=list{get(handles.popFreqResp,'Value')};
if ((str == 'Stop Band')|(str == 'Band Pass') == 1)
    set(handles.edtCutoff2,'Visible') = 'on';
    set(handles.txtRange,'Visible') = 'on';
else
    set(handles.edtCutoff2,'Visible') = 'off';
    set(handles.txtRange,'Visible') = 'off';
end

错误的全部细节     评估uicontrol回调时出错

Subscript indices must either be real positive integers or logicals.

Error in untitled>popFreqResp_Callback (line 166) set(handles.edtCutoff2,'visible')= 'on';

Error in gui_mainfcn (line 96)
    feval(varargin{:});

Error in untitled (line 42)
    gui_mainfcn(gui_State, varargin{:});

Error in @(hObject,eventdata)untitled('popFreqResp_Callback',hObject,eventdata,guidata(hObject))


Error while evaluating uicontrol Callback

1 个答案:

答案 0 :(得分:1)

你必须这样使用它:

set(handles.edtCutoff2,'Visible', 'on');