!date (note that
Matlab's date has a different result than the Linux
command).
expression, issue it as tic;
expression; toc.
'Peter''Peter''s')
mystring='Peter''s'
mystring
M=100
['the current value of M is ', num2str(M)]
help strings for moreprint -dpdf "file.pdf"
title('\bf Graph of
\beta=\alpha_1+\alpha_{21}^3')
get(H),
where H is the handle to a figure;
e.g., get(gcf) are the parameters of the
current figure).
set(H, 'property1',
'value1', 'property2', 'value2', etc.). For
example, set(gcf, 'name', 'Sine curves')
sets the name of the current window.
lookfor easy for
more such commands
fplot(@humps,[0
1]), fplot(@(x) sin(1./x), [0.01 0.1], 1e-3);
see more in help fplot
Other graphical representations: bar,
barh, stairs, stem,
pie, hist, polar, etc.
See
also fplot.
surf(x,y,z) with z a matrix of size
n x m and The value of alpha, between 0 and 1, measures the transparency: 0=totally transparent, 1=totally opaque. See more at "help alpha".[X,Y]=meshgrid(linspace(1,2,10), linspace(3,5,10)); gr=mesh(X,Y,X+Y-6,'edgecolor','green') hold on bl=mesh(X,Y,2*X-Y,'edgecolor','black') alpha(gr, .5) alpha(bl, .5)
which FUN1 in FUN2 displays
the pathname to function FUN1 in the context of the m-file
FUN2.
help matlab/lang
eval(expression)
eval(['x' '+' 'y']) is the same as
x+y.
eval with
two parameters, both strings, eval(string1,
string2); if the evaluation of the first string
fails, the second is evaluated, if that also fails an error
message is issued.
try - catch block). Below is an
example:
So, in a program, where say>> eval('u*') ??? Error: Expression or statement is incomplete or incorrect. >> eval('u*','3') ans = 3 >> eval('u*','3+') ??? Error: Expression or statement is incomplete or incorrect. >> test=0; eval('u+v+', 'test=1') test = 1
'input_string' is
a string provided by the user, can do
test=0; eval('result=input_string','test=1'); if test==1 % this means that eval('result=input_string') has failed % so do something else ..... end % otherwise, continue using result as planned .....
feval(F,x1,...,xn)
F = @foo, then
feval(F,9.64) or
feval('foo',9.64) is the same as
foo(9.64). doc fprintf.
For example, fprintf('the values are: x = %5.2f, n =
%i\n',x,n)