Function Reference
— Function File: example ('name',n)
— Function File: [x, idx] = example ('name',n)

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.

See also: demo test

Demonstration 1

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)

Demonstration 2

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)