User Tools

Site Tools


octave:octave

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
octave:octave [2008/06/25 09:56] – created devaoctave:octave [2008/07/11 17:30] deva
Line 1: Line 1:
-=====Octave===== +=====Octave syntax and library overview===== 
-====if then else end==== +====if then else==== 
-<code octave+<code matlab
-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;
 +</code>
 +
 +====for while====
 +<code matlab>
 +list = 1:10
 +
 +for i = list
 +  i
 +end;
 +
 +a = 1;
 +while a < 11
 +  a
 +  a = a + 1;
 +end; 
 +</code>
 +
 +====switch case====
 +<code matlab>
 +yesno = "yes"
 +
 +switch yesno
 +case {"Yes" "yes" "YES" "y" "Y"}
 +  value = 1;
 +case {"No" "no" "NO" "n" "N"}
 +  value = 0;
 +otherwise
 +  error ("invalid value");
 +endswitch
 </code> </code>
  
octave/octave.txt · Last modified: 2009/04/23 13:54 by deva