Tools/Octave Matlab

(Difference between revisions)
Jump to: navigation, search
(Syntax differences)
(Syntax differences)
Line 8: Line 8:
 
! Type || Octave || MATLAB
 
! Type || Octave || MATLAB
 
|-
 
|-
| String delimiters || ' or " || only '
+
| String delimiters || ' or " || only ''''''
 
|-  
 
|-  
| Ends || can use ''end{if,for,...}'' || only ''end''
+
| Ends || can use ''end{if,for,...}'' || only '''end'''
 
|-
 
|-
| Comment || # or % || only %
+
| Comment || # or % || only '''%'''
 
|-
 
|-
| Hexadecimal || supports ''0xF0'' || needs ''hex2dec('F0')''
+
| Hexadecimal || supports ''0xF0'' || needs '''hex2dec('F0')'''
 
|-
 
|-
| Autoincrement and Assign || supports ''i++; ++i; i+=1; etc.'' || no support
+
| Autoincrement and Assign || supports ''i++; ++i; i+=1; etc.'' || '''no support'''
 
|-
 
|-
| Logical Operator NOT || ! or ~ || only ~ (as used in: Not Equal: ~=)
+
| Logical Operator NOT || ! or ~ || only '''~''' (as used in: Not Equal: ~=)
 
|-
 
|-
 
|}
 
|}

Revision as of 09:07, 13 November 2012

Contents

MATLABis a numerical computing environment and programming language developed by MathWorks. GNU Octave is a free software under the terms of the GNU General Public License (GPL) using a language that is mostly compatible with MATLAB.

Syntax differences

In general Octave supports more syntax than MATLAB. Therefore scripts running on Octave might fail in MATLAB. The most notable restrictions in MATLAB compared to Octave are:

Type Octave MATLAB
String delimiters ' or " only '
Ends can use end{if,for,...} only end
Comment # or % only %
Hexadecimal supports 0xF0 needs hex2dec('F0')
Autoincrement and Assign supports i++; ++i; i+=1; etc. no support
Logical Operator NOT  ! or ~ only ~ (as used in: Not Equal: ~=)

a full list of differences is maintained in the MATLAB Programming Wikibook.

Octave

Installation

Octave is mainly built for Linux and is therefore packaged for many distributions, but it can also be installed on OS X and Windows. To test your installation in quick and easy manner you could try to print a sinusoidal curve:

t = linspace(0, 10, 100);
plot(t, sin(t));

Windows

There is full page at the Octave wiki about how to install Octave on Windows with different installers, compilers and versions. After trying some of the variants, we found out that the easiest way is to download the latest version for MinGW at Sourceforge (current version of writing this article: 3.6.2) or from guo's Software Server. There are two compressed files, one with Octave itself and one with various useful packages (alphabetical list of all functions). We recommend to install the packages also. To install just uncompress the files and follow the instructions in the readme files.

Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox