Go to the first, previous, next, last section, table of contents.

# 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 = 1.0
      default_eval_print_flag = 0.0
      default_save_format = "mat-binary"
      define_all_return_values = 1.0
      do_fortran_indexing = 1.0
      empty_list_elements_ok = 1.0
      fixed_point_format = 1.0
      implicit_num_to_str_ok = 1.0
      implicit_str_to_num_ok = 1.0
      ok_to_lose_imaginary_part = 1.0
      page_screen_output = 0.0
      prefer_column_vectors = 0.0
      prefer_zero_one_indexing = 1.0
      print_empty_dimensions = 0.0
      treat_neg_dim_as_zero = 1.0
      warn_function_name_clash = 0.0
      whitespace_in_literal_matrix = "traditional"

Some other known differences are:

- The Octave plotting functions are mostly compatible with the ones from MATLAB 3.x, but not from MATLAB 4.x.

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 bug-octave@bevo.che.wisc.edu.

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

Go to the first, previous, next, last section, table of contents.