matlab 中eval函数调用为什么总出现错误Function 'eval' is not defined for values of class 'cell'.

stra = get(handles.edit1,'String')
w = 1:0.01:5;
Abs=eval(stra)
输入 w
运行结果:
stra =

'w'

??? Function 'eval' is not defined for values of class 'cell'.

Error in ==> eval at 44
[varargout{1:nargout}] = builtin('eval', varargin{:});

这里get得到的是一个1*1的元胞数组

改成这样就可以了
Abs=eval(stra{1})
温馨提示:答案为网友推荐,仅供参考
相似回答