[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: octave to matlab conversion

From: Paul Kienzle
Subject: Re: octave to matlab conversion
Date: Sat, 8 Oct 2005 11:50:39 -0400

On Oct 8, 2005, at 4:40 AM, A S Hodel wrote:

On Oct 7, 2005, at 8:23 PM, Joe Koski wrote:

My opinion is that the perfect mat2oct or oct2mat converter (other than a knowledgeable human) will never exist because of major differences between the MATLAB toolboxes and octave-forge. There will never be a good one-to-one equivalency. Both collections will continue to have their strengths and

I firmly agree with Joe here. MATLAB and Octave are both moving targets. How many people have upgraded from Matlab 4 to 5, 5 to 6, and 6 to 7, only to discover that some formerly functional m-files or compiled mex-functions have to be rewritten? Even in Octave, we see changes from time to time (e.g., deprecation of gset). If such a converter were written, it would require regular maintenance as features are added to the two systems.

Yes the 'moving target' problem is a pain. The solution in Tcl/Tk is that "package require" can request a specific version. So for example, if you have a script use system 5.0 function interfaces then you could "package require system 5.0". A similar thing will be possible in octave if/when there is some sort of namespace support. This won't protect against changes in syntax without cruft in the core. Tricky issues are things such as the change over from indexing accepting real values to indexing requiring integers.

I use Octave and MATLAB when teaching my classes in electrical engineering. With the aid of Octave-forge, I am able to write scripts that will work in both systems. Nevertheless, at some point in a given project one may need to make a commitment to one or the other. That's where the strengths and weaknesses discussed above come into play.

When I wrote the converter (I needed my signal processing functions working with matlab) I included a simple macro processor which handled tags such as:

        title('hello');      %octave
    %title('hello');     %matlab

When converting, the percent was removed from the beginnings of lines contain %matlab and added to the beginnings of lines containing %octave. I don't remember the exact syntax. I may have had some version numbering in there as well.

Together with %! test scripts to check that the conversion was successful, it was not a lot of work to support both systems simultaneously.

- Paul

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]