标签:func fun 使用 排列 example pre variables nbsp matrix
使用eval()函数将字符串作为代码执行;
配合num2str()函数和循环结构,可访问按规律排列的文件。
>> help eval
eval Execute MATLAB expression in text.
% eval 将字符作为MATLAB代码执行;
eval(EXPRESSION) evaluates the MATLAB code in the character vector
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
See also feval, evalin, assignin, evalc.
Reference page for eval
Other functions named eval
Matlab - 将字符串作为代码执行
标签:func fun 使用 排列 example pre variables nbsp matrix
原文地址:http://www.cnblogs.com/Jian-thinker/p/7580580.html