2
votes

Hi I'm new to Octave and I barely know Matlab. I'm starting using Octave, but I want to write code that is Matlab compatible. How can I achieve this? I thought that the --traditional flag when launching Octave was made for this, but for example the simple not operator != that is not Matlab compatible still works:

se7entyse7en@Marvins-MacBook-Air:~/Projects/datascience$ octave --traditional
GNU Octave, version 4.0.0
Copyright (C) 2015 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "x86_64-apple-darwin15.2.0".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/get-involved.html

Read http://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

>> 1 != 0
ans =  1

while I expect this statement to throw an error. I didn't try others known non-compatible Matlab statements. So, is it possible to run Octave in a purely Matlab compatible way? Or are there any tools that can analyze the code and warn if a non-compatible feature has been used?

1

1 Answers

4
votes

The flag is intended to run MATLAB code in OCTAVE without problems. Detailed explanations are given here in the documentation

To receive a warning when using laguage features which are not present in MATLAB, use the warningOctave:language-extension