home *** CD-ROM | disk | FTP | other *** search
- %EVAL Execute string containing MATLAB expression.
- % EVAL(s), where s is a string, causes MATLAB to execute
- % the string as an expression or statement.
- %
- % EVAL(s1,s2) provides the ability to catch errors. It
- % executes string s1 and returns if the operation was
- % successful. If the operation generates an error,
- % string s2 is evaluated before returning. Think of this
- % as EVAL('try','catch')
- %
- % [X,Y,Z,...] = EVAL(s) returns output arguments from the
- % expression in string s.
- %
- % The input strings to EVAL are often created by
- % concatenating substrings and variables inside square
- % brackets. For example:
- %
- % Generate a sequence of matrices named M1 through M12:
- %
- % for n = 1:12
- % eval(['M' num2str(n) ' = magic(n)'])
- % end
- %
- % Run a selected M-file script. The strings making up
- % the rows of matrix D must all have the same length.
- %
- % D = ['odedemo '
- % 'quaddemo'
- % 'fitdemo '];
- % n = input('Select a demo number: ');
- % eval(D(n,:))
- %
- % Read and process files with names data1.dat, data2.dat, ...
- %
- % k = 0;
- % while 1
- % k = k+1;
- % datak = ['data' int2str(k)];
- % filename = [datak '.dat'];
- % if ~exist(filename), break, end
- % eval(['load ' filename]);
- % X = eval(datak);
- % % Process data in matrix X.
- % end
- %
- % See also LASTERR, FEVAL.
-
- % Copyright (c) 1984-93 by The MathWorks, Inc.
- % Built-in function.
-