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