recipes : Branching Out : What alternatives are there to MATLAB?

Problem

MATLAB is all well and good but maybe you think it's not the right tool for you or maybe you need something that's free. What are the options?

Solution

It's only fair to declare at the outset that this entry is more of an opion piece than a recipe. Furthermore, it's an opinion piece on somewhat controversial topic: which programming language is "best"? Obviously no one language is best at everything and I'm a fan of trying to use the right tool for the job rather than treating everything as a nail. Personally, I feel MATLAB is really good for data analysis, linear algebra, computational statistics, a lot of data acquisisition tasks, etc. It's no so good as a general purpose programming language, it's not a specialised statistics package, So what alternatives are there?

For data acquisition with National Instruments hardware there is always the option of LabVIEW. It must be said, however, that there's plenty wrong with it. Another propriotory data acquisition option is Igor Pro, but that's even worse. Don't touch it: in the words of a colleague it will "damage you for life."

What about Excel? Excel is fine for your household accounts. Don't use Excel for analysing data because it's shit for that. It's also a bad idea to analyse data in MATLAB then export to Excel for plotting. This is an excellent way of creating undocumented graphs that you then become unable to reproduce. If you analyse in MATLAB then plot in MATLAB; it'll make your life easier in the long run.

So enough with the propriotory stuff, what's free? Octave is a free MATLAB clone that is growing nicely as a project. Since many of the commands are the same, you can still use MATLAB's excellent help pages for many things to help you along. The only problem with Octave is that if you're not on Linux it can be a pain to install.

For statistics I highly recomend R. It's free, very powerful, and very well regarded. Its facilities for fitting and testing models, particularly mixed-effects (repeated measures) models, is arguably better than what you get in MATLAB. The downside of R is that it's crappy as a programming language and the many different plotting packages that come with it have inconsistent syntaxes. My personal approach is use MATLAB for pre-processing, computational stats (e.g. PCA, clustering, etc), and very simple stats (e.g. t-tests). Things like mixed-effects ANOVA and linear models I do in R by exporting data as a csv file.

What about general purpose programming? In my opinion, this is where MATLAB fails. The object-oriented programming in MATLAB is still clunky and writing big applications is rather awful what with the requirement for including every directory of your project into the MATLAB path. The GUIs MATLAB produces are ugly, too. If you want to write an application, particularly a portable one, then Python is an excellent idea. A balanced assement of MATLAB vs Python can be found here and here. Whilst

Python has made great strides over the last 5 to 10 years as a data analysis language it is still, in my opinion, still in its infancy here. It's much easier to write fast analysis code in MATLAB than in Python, where there are more gotchas waiting to snare the unwary. The linear algebra syntax is rather convoluted an unpleasant to type in Python. Whilst there are some nice plotting options in Python, no one package does everything. e.g. Matplotlib makes nice static graphs but is too slow for animatiions. For animations, as you're used to in MATLAB, you need to use PyQtGraph which has a totally different syntax to Matplotlib. Thus, analysing data in Python is still a bit incoherent. Furthermore, the language is in a constant state of flux. Five year old MATLAB code is much more likely to to work today than is five year old Python code.

 

Want to continue the discussion?
Enter your comments, suggestions, or thoughts below

comments powered by Disqus