Can you use python instead of matlab?

The MATLAB problem: portability

If you're a graduate student in science and engineering there's a chance you're already using MATLAB. If it works well for you, then by all means do keep using it. It’s a great, easy-to-use tool, with an enormous library of toolboxes for almost anything such as signal processing and financial algorithms. The problem is that when you're done with your Ms/PhD/Post-doc, you might have to leave your MATLAB skills behind.

MATLAB is not portable since it requires expensive licencing. Academic access is usually not the problem as most universities pay for it. But academic jobs are scarce, and many scientists and engineers will need to transition to the industry or even outside their field of study. MATLAB is much rarer outside of academia, so chances are these new graduates won’t be able to directly apply their expertise in their new job.

Python can replace MATLAB

Python is free and available on every platform and therefore is highly portable. Although Python was not intended as a free alternative to MATLAB, it's actually well suited for this role. Many people have successfully made the switch from MATLAB to Python. The SciPy stack has almost everything you might need for scientific computing, such as numpy for numerical computation, matplotlib for plotting and scikit-learn for machine learning. Python is also one of the easiest programming languages to learn with its readable, simple syntax. It's incredibly versatile and powerful, being used for anything from interactive data visualization to web server hosting and software development.

Python is quickly becoming one of the top skills in several industries. Python coding skills could be critical when job hunting since many graduate students will not stay in academia, or even in research, after graduation. So why not learn it during your studies?

How can I start?

First, here's an introduction on transitioning from MATLAB to Python.

I recommend installing Anaconda, a Python distribution that comes with all the core scientific packages. Install the Python 3.6 version unless you depend on legacy Python 2.7 code.

MATLAB expats will be looking for an interface similar to the MATLAB editor, which they will find in Spyder (bundled with Anaconda). Newcomers to Python should also use Spyder or another IDE.

Finally, learn about the scientific Python environment and start using Python in your research!

Conclusion

All is not lost if you’re learning MATLAB right now. Most of your MATLAB skills will readily transfer to other scripting languages. I simply think your time would be better spent learning to use Python whether you plan on staying in academia or not (especially if you are looking for opportunities outside of research).

What Is Python?

Python is a general-purpose programming language with an extensive collection of libraries that are used for a wide range of applications, including web development, enterprise application development, and data science. 

What Is MATLAB?

MATLAB is a computing platform that is used for engineering and scientific applications like data analysis, signal and image processing, control systems, wireless communications, and robotics. MATLAB includes a programming language, interactive apps, highly specialized libraries for engineering applications, and tools for automatically generating embedded code. MATLAB is also the foundation for Simulink, a block diagram environment for simulating complex multi-domain systems.

Language Comparison

The language of Python and MATLAB can be used interactively (a single command at a time) or to develop large-scale applications. Both languages support scripting, procedural and object-oriented programming.

Python has largely replaced Java as the first language for people who want to learn how to program because it is easy to learn and can be used for various programming tasks. MATLAB language is the first (and often only) programming language for many engineers and scientists because the matrix math and array orientation of the language makes it easy to learn and apply to engineering and scientific problem-solving. Apps and other interactive tools automatically generate MATLAB code, further reducing the barrier to entry.

User Base

Both Python and MATLAB have large user bases, though the user base for MATLAB is primarily comprised of engineers and scientists. As of May 2022, LinkedIn searches return about 7.6 million Python users and 4.1 million MATLAB users. People who do not work in engineering or science are often surprised to learn how widespread MATLAB is adopted, including:

  • Millions of users in colleges and universities
  • Thousands of startups
  • Thousands of people at every major company and organization where engineers and scientists work, such as Apple, Google, Airbus, Tesla, and the International Monetary Fund

Support and Documentation

Stack Overflow and similar sites are the primary support mechanism for most Python users. With so many users worldwide, it is easy to find or start a discussion online that can help answer just about any question. Documentation is available via docstrings and individual websites for Python and most libraries.

MATLAB licenses include free live support, so users can pick up the phone or send an email to get help from a MATLAB expert on their specific project. Additional free support from MathWorks worldwide engineers can help users figure out the best way to assemble available technology for their application, research, or teaching. MATLAB Answers provides an online question and answer forum specific to MATLAB, similar to Stack Overflow. MATLAB includes an integrated documentation system that combines professionally authored documentation for all MATLAB and Simulink products, help for user-authored packages, and additional online resources such as MATLAB Answers and videos.

Cost

Python and most Python libraries are free to download or use, though many users use Python through a paid service. Paid services help IT organizations manage the risks associated with the use of open-source software, such as security, licensing, and access control. Paid services also provide access to packaged or hosted distributions that eliminate much of the pain of configuring a Python installation with compatible versions of libraries.

MATLAB is not free, though it is more accessible and costs less than people assume. Approximately 8 million people have unlimited access to MATLAB through their school, research institution, or employer, including at most universities worldwide that grant engineering and science degrees. Institutions choose to invest in MATLAB because they recognize the value of the increased productivity from providing their engineers and scientists with purpose-built tools.

MATLAB and Python

While most people start by asking whether they should choose MATLAB or Python, the right answer is often to use MATLAB and Python together. With MATLAB and Python, you can take advantage of the best capabilities of each environment. For instance, you can:

Is MATLAB or Python more useful?

This section has an easy answer: Python is the winner over Matlab. Python has tons of libraries and packages for both old school and new school machine learning models. Plus, Python is the most widely used language for modern machine learning research in industry and academia.

Should I learn MATLAB if I know Python?

There are a lot of similarities between MATLAB and Python, so your Python experience should be a good head start for learning MATLAB. This blog post examines the similarities and differences between MATLAB and Python and provides syntax examples for applying general programming concepts in MATLAB.