MATLAB 下标索引必须是实数正整数或逻辑数
Posted
技术标签:
【中文标题】MATLAB 下标索引必须是实数正整数或逻辑数【英文标题】:MATLAB Subscript indices must either be real positive integers or logicals 【发布时间】:2013-12-04 14:58:14 【问题描述】:我不知道代码有什么问题。这是sn-p。
function popFreqResp_Callback(hObject, eventdata, handles)
list=get(handles.popFreqResp,'String');
str=listget(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
【问题讨论】:
另见this questionthe generic solution to this problem。 【参考方案1】:你必须这样使用它:
set(handles.edtCutoff2,'Visible', 'on');
【讨论】:
以上是关于MATLAB 下标索引必须是实数正整数或逻辑数的主要内容,如果未能解决你的问题,请参考以下文章