Display the code for example n associated with the function 'name', but do not run it. If n is not given, all examples are displayed.
Called with output arguments, the examples are returned in the form of a string x, with idx indicating the ending position of the various examples.
See
demo
for a complete explanation.
The following code
example('example');
Produces the following output
example example 1: example('example'); example example 2: t=0:0.01:2*pi; x=sin(t); plot(t,x)
The following code
t=0:0.01:2*pi; x=sin(t); plot(t,x)
Produces the following figure
example example 1: example('example'); example example 2: t=0:0.01:2*pi; x=sin(t); plot(t,x)
![]() |