I recently have been considering switching to the Python programming language. Currently, Matlab is the language of choice in my department for rapid development and prototyping of code. It’s very good at this, but Mathworks (the company who produces Matlab) have been tinkering with the licencing terms, leading to hassles where none should exist.
6 Answers
I have found python+numpy+scipy+matplotlib+IPython+[random sci/numerical packages] to be almost a complete replacement for matlab. There are certainly some packages missing, so if there is a specialized set of tools that are available in matlab but not in python, this might be an issue, but otherwise, I haven't looked back.
I'll mention a couple of distinct advantages of python over matlab
- True programming language instead of a hack of a language thrown over a numerical package (numpy came to python instead of the other way around). Managing large python projects is a complete joy vs matlab. How many different oop systems have been mangled into matlab?
- Totally free and portable. I can use python on just about any machine without licensing issues. This is the biggest advantage from my perspective.
- Wrapping other libraries in C,C++, Fortran is fairly straightforward using SWIG, Cython,f2py,etc vs the ugliness that is a mex file
- Cython for accelerating slow code (although I find that numpy is nearly as fast if not faster than matlab)
- mpi4py vs some other package that I have to buy from matlab to run parallel applications
Personally I use the Enthought Python Distribution for a lot of my work, because it packages everything and is free for individuals in academia. I've alternatively built python and all of its libraries and modules from scratch. Module management is perhaps the largest weakness in python, but there are some nice things to help out like virtualenv
and pip

- 66,734
- 27
- 141
- 140
-
9"How many different oop systems have been mangled into matlab?" I have used only six: 1. old style OO 2. old shema 3. emulation with closures (nested function) 4. emulation with global/persistent 5. new style OO 6. using Java objects. Is there any more? – Mikhail Poda Feb 21 '11 at 17:50
-
1Why do you say that module management is a weakness for python? I think it's amazing. You can have local or global (system-wide) modules and the whole namespacing system keeps everything clean. – fstab May 19 '14 at 21:22
-
I think that there might be a small misconception: by “module management”, the answer refers to “module distribution” (which is indeed a challenge, being addressed gradually by `pip` changes lately), not namespaces, which [“Namespaces are one honking great idea -- let's do more of those!”](https://www.python.org/dev/peps/pep-0020/). – 0 _ Apr 22 '15 at 23:39
The choice comes down to cost. If you are happy paying for Matlab - especially if you use the toolboxes - you will likely find Python doesn't provide such an integrated package. Having a matrix as the basic data type makes Matlab an intuitive language for many mathematical tasks. Personally, I find the this coupled with the debugger invaluable.
Python, through NumPy, SciPy and the like do provide the same functionality. There will of course be a learning curve to overcome.
If you are performing general programming tasks, that are not particularly applied math solutions then Python is an extremely easy to use and adaptable language. It is also free - which may be a deciding factor.

- 143
- 5
If you're looking for a wholesale Matlab replacement, you may want to take a look at Python(x, y). It aims to provide a more cohesive experience, rather than leaving new users to trawl the internet themselves looking for the right components to use.
Another option is GNU Octave, which is essentially an open-source clone of MATLAB.
Python certainly is useable as a replacement for Matlab for many cases, by using NumPy, SciPy, and Matplotlib (see my development environment setup guide for how to install all these packages). However, there are some things that Matlab does better, such as providing libraries for interfacing with data collection hardware. So you will need to try Python and see if it meets your requirements.

- 93,612
- 16
- 138
- 200
Should you switch or not depends on what you think of Python. I myself love Python, and I know it is extremely effective for rapid prototyping. The syntax is clean and crisp, and very easy to learn.
To make your decision I recommend visiting the home page, Python.org, and having a look at the docs.

- 495
- 3
- 5