comparison scripts/testfun/demo.m @ 14335:ce2b59a6d0e5

maint: periodic merge of stable to default.
author Rik <octave@nomad.inbox5.com>
date Sun, 05 Feb 2012 15:32:24 -0800
parents 11949c9795a0 4d917a6a858b
children 7277fe922e99
comparison
equal deleted inserted replaced
14333:6dd710b73150 14335:ce2b59a6d0e5
32 ## prefix with no intervening spaces. The remainder of the example can 32 ## prefix with no intervening spaces. The remainder of the example can
33 ## contain arbitrary Octave code. For example: 33 ## contain arbitrary Octave code. For example:
34 ## 34 ##
35 ## @example 35 ## @example
36 ## @group 36 ## @group
37 ## %!demo 37 ## %!demo
38 ## %! t = 0:0.01:2*pi; 38 ## %! t = 0:0.01:2*pi;
39 ## %! x = sin (t); 39 ## %! x = sin (t);
40 ## %! plot (t,x); 40 ## %! plot (t, x);
41 ## %! %------------------------------------------------- 41 ## %! %-------------------------------------------------
42 ## %! % the figure window shows one cycle of a sine wave 42 ## %! % the figure window shows one cycle of a sine wave
43 ## @end group 43 ## @end group
44 ## @end example 44 ## @end example
45 ## 45 ##
46 ## Note that the code is displayed before it is executed, so a simple 46 ## Note that the code is displayed before it is executed, so a simple
47 ## comment at the end suffices for labeling what is being shown. It is 47 ## comment at the end suffices for labeling what is being shown. It is
51 ## variables. This means that every demo must have separate initialization 51 ## variables. This means that every demo must have separate initialization
52 ## code. Alternatively, all demos can be combined into a single large demo 52 ## code. Alternatively, all demos can be combined into a single large demo
53 ## with the code 53 ## with the code
54 ## 54 ##
55 ## @example 55 ## @example
56 ## %! input("Press <enter> to continue: ","s"); 56 ## %! input("Press <enter> to continue: ","s");
57 ## @end example 57 ## @end example
58 ## 58 ##
59 ## @noindent 59 ## @noindent
60 ## between the sections, but this is discouraged. Other techniques 60 ## between the sections, but this is discouraged. Other techniques
61 ## to avoid multiple initialization blocks include using multiple plots 61 ## to avoid multiple initialization blocks include using multiple plots
70 ## multiple lines, you must wrap your demo in "if 1 <demo stuff> endif" 70 ## multiple lines, you must wrap your demo in "if 1 <demo stuff> endif"
71 ## with the 'if' on the same line as 'demo'. For example: 71 ## with the 'if' on the same line as 'demo'. For example:
72 ## 72 ##
73 ## @example 73 ## @example
74 ## @group 74 ## @group
75 ## %!demo if 1 75 ## %!demo if 1
76 ## %! function y=f(x) 76 ## %! function y=f(x)
77 ## %! y=x; 77 ## %! y=x;
78 ## %! endfunction 78 ## %! endfunction
79 ## %! f(3) 79 ## %! f(3)
80 ## %! endif 80 ## %! endif
81 ## @end group 81 ## @end group
82 ## @end example 82 ## @end example
83 ## 83 ##
84 ## @seealso{test, example} 84 ## @seealso{test, example}
85 ## @end deftypefn 85 ## @end deftypefn