85

In our shoestring operation we need to prototype algorithms in some higher-level language before committing to a C implementation on embedded hardware.

So far we have been using MATLAB to do that, but the licensing costs are beginning to hurt. We're considering porting our MATLAB code to Octave.

Is there any particular reason not to do that? Will we break any compatibility, especially if we have external partners who insist on using MATLAB? Are there any performance penalties we can expect?

lindelof
  • 34,556
  • 31
  • 99
  • 140

11 Answers11

54

In 2008 I tried doing the same thing. I quickly noticed the following show stoppers:

  • Toolboxes are not as complete and not as well tested. Particularly the image processing toolbox that my work relied heavily upon (the big show stopper was that imtransform was not implemented).
  • The Octave debugger and profiler were primitive compared to Matlab's.
  • If you work with others, it may be very difficult to get them to change.
  • If you use third party toolboxes, you are on your own getting them to work.
  • Octave's plots are not publication quality.

But I have to say that I was generally impressed at how compatible Octave is with Matlab, if your use of Matlab is basic, you may get lucky. Finally this was in 2008, in two years things can change a lot.

Jori
  • 1,122
  • 2
  • 18
  • 36
carlosdc
  • 12,022
  • 4
  • 45
  • 62
  • 8
    I don't think the problem has anything to do with MATLAB users. It is great that there is a FOSS alternative and people that want to work on such an effort do so. People get to do with their time whatever they want to do. Criticizing the users of a given program is childish. – carlosdc Jul 09 '13 at 02:31
  • 2
    For anyone who is interested, it follows the link for Octave 3.8 Windows installer: http://mxeoctave.osuv.de/ – juliohm Feb 24 '14 at 12:21
  • 2
    These issues can be overcomed through https://www.bountysource.com/teams/gnu-octave/issues website for money cost ten times lesser then one Matlab license. – Sergei Krivonos Jan 28 '17 at 16:21
  • 2
    As of 2017, you should really give it a try. You'll be surprised that most, if not all, your MATLAB scripts will run out-of-the box (apart from specific toolboxes), must you spend one afternoon correcting some minor incompatibilities. What is one afternoon in comparison to the gain of developing on license-free, open source software? – Hugo Raguet Aug 07 '17 at 12:49
24

Just off the top of my head:

  1. There are many toolboxes that Octave does not have, as I discovered when I tried to do homework in a Machine Learning course two semesters ago.
  2. Octave has a much inferior debugger. It was almost impossible to work with.
  3. Matlab is much faster for many types of operations.
  4. Matlab's plots are a lot nicer.
  5. Octave doesn't have a native GUI. There are GUIs for Octave, but they are inferior to Matlab's native one.
Nathan Fellman
  • 122,701
  • 101
  • 260
  • 319
  • +1 for point #5. I haven't even found a free GUI for Octave that I can install and that works reliably, let alone a good one. SciLab might be a good alternative to Matlab, but I don't know how good it is regarding points #1-4. – Stefan Smith Mar 18 '14 at 21:24
14

I've tested octave and R too.

Regarding octave: I was very impressed with the similarity of octave syntax. It didn't take me much time to transport my MATLAB scripts to octave. Meanwihile I have a particular problem on printing markers jointly with errorbar wich was fixed by Jarno Rajahalme at nabble and to change the xtick font size, which workaround I got in a question response at nabble. So it still have some bugs which with some effort can be overcome. If you experience some problems you may try nabble mailing forum: help-octave@octave.org. By the way my team cannot adapt (user friendly) to it such as they adapt to MATLAB, so we're still using MATLAB. Since MATLAB is built under gnuplot, another way to correct its bugs is editing the generated gnuplot file. The best IDE I found to it was QtOctave, that I made a short review in "Remember Blog".

Regarding R: according to a research made by SciViews, R's performance is superior to MATLAB and octave. I don't have much experience with R. I studied mclust package to wrote a wikibook chapter about EM Clustering in R. By the way, they seem to have a very active community. So you may find third party packages to proposals, which are not IMO so standardized. The best IDE I found was StatET plugin for eclipse, JGR (Java GUI for R) and emacs. Despite the time cost to learn a new programming language, if I would choose an open source platform to make my experiment graphics and some data mining analysis I would try R.

Internet User
  • 39
  • 1
  • 7
10

Octave has several syntactic improvements on matlab, for example you can say endif endfor and endfunction instead of just end, which make debugging much easier.

Octave also allows you to dynamically generate functions, and have multiple functions defined in scripts and function file. Which is way nicer than matlab's one-file-one-function approach.

Finally, octave has parcellfun and pararrayfun which are very powerful parallel processing tools which matlab completely lacks. There is a parfor in matlab, but it's not the best way of doing it in my opinion.

Cons for octave are that they are slightly behind on toolboxes, though if you look you can find things similar. fsolve and lsode seem a little slower, but more robust, in octave for some reason. Also a big bummer for some people tends to be the lack of symlink and the DAQ toolbox, but that stuff is going to be proprietary anyway.

Python/Numpy is definitely worth a whirl: it's more powerful but their syntax is aimed at more complex pieces of code.

rbrito
  • 2,398
  • 2
  • 21
  • 24
user1240280
  • 131
  • 1
  • 4
  • 1
    I just tried it, and as far as I can tell, pararrayfun/parcellfun are not supported on Windows (well not natively without Cygwin) `failed to open pipe: pipe: not supported on this system`. I am using the prebuilt Windows binaries `Octave_3.6.1_VS2010`. – Amro Jun 30 '12 at 17:21
  • 2
    yeah I guess that's down to the differences in how shell scripts are run in windows and Linux, as pararrayfun/parcelfun works by spawning some child processes. I dont know how this would work on windows, I am not even sure if the windows binary is executed in a shell or if its emulated? – user1240280 Jul 01 '12 at 20:44
  • 1
    too bad, a (portable) parallel version of cellfun/arrayfunc seems like a good idea... Maybe MATLAB should those too :) – Amro Jul 02 '12 at 07:49
  • @user1240280 : being able to define functions within a script is IMHO a huge advantage of Octave over Matlab. It enables you to write an entire program in modular fashion and keep it in one file, so you can easily send it to yourself or others. But Octave's lack of a GUI is a big drawback. – Stefan Smith Mar 18 '14 at 21:21
  • @stefan smith: Octave now has a native GUI, still experimental but from my recent experiences its quite usable and more or less stable. you can try it out with `octave --force-gui` – Legionair Jan 15 '15 at 12:24
9

Octave doesn't have guide, which makes building GUIs super easy. I regularly use guide for making tools for my non-MATLAB using colleagues.

Doresoom
  • 7,398
  • 14
  • 47
  • 61
8

For your use case, octave may be superior to MATLAB:

  • It has syntax that will allow you to write code that is slightly closer to C. i.e. +=, -=, default function parameter values, double-quoted string literals, etc...

  • Assuming your chips are slower than a desktop processor, speed will likely not be an issue.

  • Since it launches far faster than matlab, it is more practical to integrate into shell scripts for testing.

  • For prototyping, the plotting is more than adequate; people are just used to MATLAB's style.

  • The relative lack of toolboxes isn't a big deal since they wouldn't be available on your target platform anyway.

I use both, and whenever I switch, I miss features from the other.

Andrew Wagner
  • 22,677
  • 21
  • 86
  • 100
6

It's interesting to see how the open source alternative works for statistics but not for numerical analysis. R (the octave of statistics) is nowadays much popular than the commercial S-plus (the matlab of statistics). The issues mentioned as reasons not to switch away from matlab found in the other answers were also applicable to R. But still everybody just started contributing and now R is the standard, with better graphics, better packages and no more vendor lock-in.

So you could prefer octave over matlab as well, if you can step over the prisoners dilemma.

SiggyF
  • 22,088
  • 8
  • 43
  • 57
5

There's a good WikiBook on MATLAB with a list of differences between MATLAB and Octave.

In my experience, core MATLAB is well ported to Octave, but the toolboxes have varying levels of compatibility, so your decision depends on what exactly you are trying to code.

Some things that Octave lacks, AFAIK, are the tight integration with .NET code and the gui builder, guide (though there are many other GUI builing tools that Octave can use).

Also, as others have pointed out, much of what you pay for with MATLAB is the slick interface and debugging/profiling tools. Experienced coders can probably manage with the alternatives, but newbies may struggle.

Richie Cotton
  • 118,240
  • 47
  • 247
  • 360
3

Note that Octave supports language constructs that aren't present in Matlab (e.g., auto-increment operators, do-until statements, etc.). This makes it sometimes annoying to port code developed (by someone who isn't familiar with the limitations of Matlab) on Octave to a Matlab environment.

There are some other limitations/differences at Octave FAQ.

jhfrontz
  • 1,165
  • 4
  • 19
  • 31
2

You should definitely prefer Matlab to Octave if you can afford it.

I have not had much experience with Octave, but I would expect issues if your code is using Matlab toolboxes, fancy plots, or Matlab gui.

I would expect it to be like OpenOffice vs. MS Office. Mostly compatible, but just different enough to give you a headache.

Dima
  • 38,860
  • 14
  • 75
  • 115
0

I have successfully ported some linear regression and quadratic programming applications to Octave.

The linear regression (backslash operator) worked without any adjustment. In case of quadratic programming I had to switch from fmincon() to sqp(), giving similar results.

Still, the toolboxes and GUI in Octave are, indeed, less mature (I spent so much time on basic stuff), although it has been rapidly making progress over the past two years.

Ben
  • 1,519
  • 23
  • 39