注册 登录
编程论坛 Matlab

关于advisor中的一个m文件

yaoyaozhi 发布于 2015-06-25 16:35, 2697 次点击
将advisor运行在matlab环境中时,想通过界面打开advisor中的m 文件时,总报错说
未定义与 'cell' 类型的输入参数相对应的函数 'eq'。

出错 gui_current_str (line 20)
if value ==0
 
Error while evaluating UIControl Callback

原gui_current_str.m 文件如下
function str=gui_current_str(tag)

%str=gui_current_str(tag)  ADVISOR 2.0 function
%
%    This function is used to find the current string of a popupmenu or list
%    using the tag of the desired uicontrol.  tag is a string.
%    example str=gui_current_str('drivetrain') might return str='parallel'.
%


if nargin==0
   return
end
% find the object handle h of the object with the tag property tag.
h=findobj('tag',tag,'type','uicontrol');

%find the value (an integer) indicating which row of the string matrix the
%object is currently set on.
value=get(h,'value');
if value ==0                (报错的行)
   value=1;
end

%find the list of options for the object
stringmatrix=get(h,'string');

%select only the string from the list corresponding to the value
tempstr=char(stringmatrix(value,:));

%eliminate trailing blank spaces
tempstr=deblank(tempstr);
if isempty(tempstr)
   error('empty string');
else
   str=tempstr;
end
2 回复
#2
zhy13202017-09-06 11:12
请问你是怎么解决的?
#3
zhy13202017-09-06 12:19
1