User Tools

Site Tools


octave:octave

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
octave:octave [2008/06/25 10:00] devaoctave:octave [2008/08/06 15:45] deva
Line 1: Line 1:
-=====Octave=====+=====Octave syntax and library overview===== 
 + 
 +====function==== 
 +<code matlab> 
 +function retval = myfunction(param1, param2) 
 +  retval = param1 + param2; 
 +end; 
 +</code> 
 + 
 +====string array==== 
 +<code matlab> 
 +myarray = { 'hello', 'world' }; 
 + 
 +</code> 
 ====if then else==== ====if then else====
 <code matlab> <code matlab>
Line 29: Line 43:
 end;  end; 
 </code> </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;
 +case "blah"
 +  value = 42;
 +otherwise
 +  error ("invalid value");
 +endswitch
 +</code>
 +Note: In matlab the ''endswitch'' should be replaced by ''end''
  
 ====Links==== ====Links====
octave/octave.txt · Last modified: 2009/04/23 13:54 by deva