octave:octave
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
octave:octave [2008/06/25 09:56] – created deva | octave:octave [2008/07/11 17:30] – deva | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | =====Octave===== | + | =====Octave |
- | ====if then else end==== | + | ====if then else==== |
- | < | + | < |
- | a = 1 | + | a = 1; |
if a == 1 | if a == 1 | ||
+ | "a is one" | ||
end; | end; | ||
+ | |||
+ | if a == 2 | ||
+ | "a is two" | ||
+ | else | ||
+ | "a is not two" | ||
+ | end; | ||
+ | </ | ||
+ | |||
+ | ====for while==== | ||
+ | <code matlab> | ||
+ | list = 1:10 | ||
+ | |||
+ | for i = list | ||
+ | i | ||
+ | end; | ||
+ | |||
+ | a = 1; | ||
+ | while a < 11 | ||
+ | a | ||
+ | a = a + 1; | ||
+ | end; | ||
+ | </ | ||
+ | |||
+ | ====switch case==== | ||
+ | <code matlab> | ||
+ | yesno = " | ||
+ | |||
+ | switch yesno | ||
+ | case {" | ||
+ | value = 1; | ||
+ | case {" | ||
+ | value = 0; | ||
+ | otherwise | ||
+ | error (" | ||
+ | endswitch | ||
</ | </ | ||
octave/octave.txt · Last modified: 2009/04/23 13:54 by deva