Matlab中的eval命令
Matlab中输入help eval
eval(EXPRESSION) evaluates the MATLAB code in the string EXPRESSION.
= eval(EXPRESSION) returns output from EXPRESSION
in the specified variables.
Example: Interactively request the name of a matrix to plot.
expression = input('Enter the name of a matrix: ','s');
if (exist(expression,'var'))
plot(eval(expression))
end
注释:eval命令是将括号中的字符串表达式当作Matlab命令来执行
例如:在Matlab中,输入a=1,跟eval('a=1')是等价的
页:
[1]