Next: , Previous: Bug reports, Up: Top


11 Porting programs from Matlab to Octave

“I wrote some code for Matlab, and I want to get it running under Octave. Is there anything I should watch out for?”

The differences between Octave and Matlab typically fall into one of three categories:

  1. Irrelevant.
  2. Known differences, perhaps configurable with a user preference variable.
  3. Unknown differences.

The first category, irrelevant differences, do not affect computations and most likely do not affect the execution of function files.

The differences of the second category are usually because the authors of Octave decided on a better (subjective) implementation that the way Matlab does it, and so introduced “user preference variables” so that you can customize Octave's behavior to be either Matlab-compatible or to use Octave's new features. To make Octave more Matlab-compatible, put the following statements in your ~/.octaverc file, or use the command line option `--traditional', which implies all of these settings. Note that this list may not be complete, because some new variables may have been introduced since this document was last updated.

       PS1                           = ">> "
       PS2                           = ""
       beep_on_error                 = true
       crash_dumps_octave_core       = false
       default_save_format           = "mat-binary"
       fixed_point_format            = true
       page_screen_output            = false
       print_empty_dimensions        = false
       warn_function_name_clash      = false

Some other known differences are:

The third category of differences is (hopefully) shrinking. If you find a difference between Octave behavior and Matlab, then you should send a description of this difference (with code illustrating the difference, if possible) to [email protected].

An archive of old postings to the Octave mailing lists is maintained on ftp.che.wisc.edu in the directory /pub/octave/MAILING-LISTS.