MATLAB is inferior to Python in every way that matters. So why do engineers insist on using it?

There are only two kinds of MATLAB users:
(1) those who prefer Python
(2) those who don’t know Python.

Over the past two decades, the Python programming language has emerged as a superior (and free) alternative to the once-ubiquitous MATLAB language. But while some programs have shaken loose from the iron grip of Math Works, many remain staunchly devoted followers.

Resistance to change is nothing new. As long as there has been progress, there have been Luddites resisting it. In the early twentieth century, even after electric infrastructure had been firmly established, people were convinced that they did not need electricity, to the extent that entire advertising campaigns were dedicated to convincing people that it was useful. But what is it that prevents modern scientists and engineers, the very people responsible for creating technology, from making the change?

Learning python requires work

Learning python, as with any new skill, requires considerable time and effort. To many, the perceived marginal increase in benefit is not worth the seemingly daunting task of learning a new language and platform. For these would-be python users, the grueling experience of installing MATLAB, wrangling license servers, and learning the unintuitive syntax is painful enough so that they (understandably) never want to go through it again. Consequently, the idea that one can simply log on to a colaboratory notebook, for free, and run a program in seconds, is completely foreign to the MATLAB user.

Moving from MATLAB to Python is not just learning how to use a new language, it is learning how to be a better programmer.

Many MATLAB users also do not realize just how similar Python syntax is to MATLAB. Many of the Python toolkits (numpy and matplotlib in particular) were explicitly designed to have a MATLAB-like interface. Migrants to Python will immediately discover comfortable commands such as linspace and clf available for their use. Not all aspects of the switch are easy – I have had many students come to me in confusion over the need to “import” packages – but these are usually the result of having to unlearn bad the programming practice indemic to MATLAB. In other words, moving from MATLAB to Python is not just learning how to use a new language, it is learning how to be a better programmer.

Scientists and engineers are victims of the predatory Math Works model

Students are routinely manipulated into investing in the MATLAB world through university pressure and low student prices. By the time Math Works tightens the screws on young professionals, they are so entrenched in the MATLAB world that they feel it is impossible to change. This is compounded by the commitment bias felt by industry: abandoning MATLAB means acknowledging that the hundreds of thousands of dollars spent on license fees is, effectively, wasted money.

The MATLAB model also deliberately cultivates the idea that extensions must be purchased. Python has an entire universe of free, well-maintained, and well-documented libraries with applications including machine learning, scientific plotting, image processing, and data science, to name but a few. The concept of “I want to use this extension but cannot afford it” simply does not exist in the Python world.

Universities are convinced that MATLAB skills are necessary for employment in industry

Universities view MATLAB competence as an essential ingredient of a resume. Therefore, they build MATLAB-based assignments into nearly every level of the engineering education. While it is true that MATLAB is useful in many industry jobs, Python overwhelmingly exceeds MATLAB in popularity on nearly every list including PYPL, TIOBE, and many others. In fact, when you control for languages that are well-suited for science/engineering applications, Python tops every single list. MATLAB, on the other hand, is at the bottom of every list, generally trailing Python by at least an order of magnitude in market share. The implication is clear: to produce more marketable graduates, universities should teach them python.

Even if this were not the case: it is much easier to learn MATLAB knowing Python, then it is to learn Python knowing MATLAB. Python is a well-designed and efficient language that was designed from the beginning for versatility. MATLAB, on the other hand, started life as a matrix calculator that was since successively modified to add an increasing number of features. As a result, most of the difficulty in learning MATLAB is simply due to poor language design. Python students can, with relative ease, learn MATLAB.

Legacy MATLAB code holds developers back

This is perhaps the most understandable reason. Many companies and research groups have invested heavily in development of MATLAB-based tools. Even if they have the desire to change, then, the cost of migration is dramatically increased: to move an entire code base to a new platform requires a great deal of time and effort. But any maintainer of MATLAB code also knows that legacy MATLAB code even holds MATLAB developers back: Math Works is notorious for breaking backwards compatibility with little regard for the inconvenience caused to the developers. This makes MATLAB software costly and inconvenient (not to mention downright irritating) to maintain. By contrast, Python developers are extremely dedicated to maintaining backwards compatibility. And, in the rare instances of Python versioning problems, it’s easy to switch back and forth between versions since Python is free.

Even without the dramatic advantages of switching to Python, maintaining legacy software is never a good reason to resist adoption of superior technology. All code must be regularly maintained and tested, to the extent that migration to a new language should not be an insurmountable challenge. In other words: if legacy code is too difficult to move to Python, then it should be either scrapped or re-written altogether.

Traditional paid support is overvalued

One of the only true advantages of paying for MATLAB is that it comes with traditional, pick-up-the-phone-and-call support. For many, this is attractive, and for some it is deemed essential. (Math Works, in its Python/MATLAB comparison page, lists paid support as the only real advantage of MATLAB.)

However, as the Math Works page itself notes, the enormous global Python community has generated a mind-boggling amount of documentation. One has only to search a couple of times to appreciate the wealth of knowledge that is freely available on Stack Overflow. And one has only to post a single question online to experience the speed and comprehensiveness of the help provided from the community.

Conclusion

Just as internal combustion engines replaced horse-drawn carriages, or electric light bulbs replaced lanterns, Python will eventually take the place of MATLAB – despite the protestations of die-hard MATLAB adherents. Ability to adapt to new technology is a key factor to success, because it is correlated with willingness to learn new abilities and improve skills.