Matlab中的eval命令

来源:互联网 发布:excel每隔几行取数据 编辑:程序博客网 时间:2024/06/05 02:40
Matlab中输入help eval
eval(EXPRESSION) evaluates the MATLAB code in the string EXPRESSION.
 
    [OUTPUT1,...,OUTPUTN] = 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')是等价的

0 0
原创粉丝点击