Transitioning from MATLAB to Python

Author: Alexandre Chabot-Leclerc, Ph.D., Director, Training Solutions

Download the guide here.

If you are not yet a user of Python, and its move to become the most common programming language has piqued your interest, the Enthought training team has updated its popular reference guide, ‘Transitioning from MATLAB® to Python’. The guide highlights some of the most important differences between the two languages, including:

  • The fundamental data types
  • How code is organized in packages 
  • An overview of the syntax differences
  • How indexing and slicing work
  • NumPy arrays compared to MATLAB matrices
  • How Python mainly uses an object-oriented programming paradigm.

In addition, the guide explores common tasks when doing data analysis or running simulations, with a focus on the most common packages used for each task, such as loading data, cleaning and reformatting data, performing analysis or simulation, plotting, and saving data. 

Finally, it introduces two strategies to transition gradually to Python. Both rely on testing to validate that the new Python code works the same way as your MATLAB® code. The problem is approached in 2 ways; by either converting all functions directly to Python or by calling Python from MATLAB®

Download the guide here.

Watch the webinar on migrating from MATLAB to Python here.

MATLAB to Python

 

Why transition from MATLAB® to Python?

If you’re unsure of whether you’d like to transition to Python, we’ve collected some of the most commonly cited reasons for the change. Cost is often the first reason given, as licensing fees add up quickly and may account for a significant part of a small organization’s budget. Python has the appeal of being free, because you do not have to pay a license fee and you have access to many free open source packages. 

Choosing Python – or any other open source language – lets you run your code without being locked-in with a given provider. There is no need to pay a license fee in order to keep your software running. More importantly, it means that colleagues, and others, can run Python code without requiring a license. This can greatly improve the chances of survival for your project.

Finally, Python has the benefit of being a general purpose programming language. Though it is an excellent language for scientific computing, it is not solely a scientific computing language. It can be used to do everything from building a file synchronization system, a photo-sharing service, a 3D modeling and video-editing application, and a video hosting platform, to  discovering gravitational waves. 

The consequence of such varied uses is that you can find tools to do almost all common tasks. This allows you to use Python for your entire application, from hardware control and number crunching, to web API and desktop application. And for cases when a feature or a library exists only in another language, Python can easily interface with C/C++ and Fortran libraries. There are also Python implementations for some of the major other languages, such as IronPython for C, and Jython for Java.

Download the guide here.

 

Build your Python skills

Enthought offers a number of Python training courses for those looking to improve their skills. If you are currently a MATLAB user, we recommend Enthought’s Python for Scientists and Engineers as the perfect entry point into the scientific Python world. Sign up for a training session through our website, or contact us to learn more about our on-site corporate programs.

 

About the Author

Alexandre Chabot-Leclerc, Ph.D., Director, Training Solutions holds a Ph.D. in electrical engineering and a M.Sc. in acoustics engineering from the Technical University of Denmark and a B.Eng. in electrical engineering from the Université de Sherbrooke.

Share this article:

Related Content

Understanding Surrogate Models in Scientific R&D

Surrogate models are reshaping R&D by making research faster, more cost-effective, and more sustainable.

Read More

R&D Innovation in 2025

As we step into 2025, R&D organizations are bracing for another year of rapid-pace, transformative shifts.

Read More

Revolutionizing Materials R&D with “AI Supermodels”

Learn how AI Supermodels are allowing for faster, more accurate predictions with far fewer data points.

Read More

What to Look for in a Technology Partner for R&D

In today’s competitive R&D landscape, selecting the right technology partner is one of the most critical decisions your organization can make.

Read More

Digital Transformation vs. Digital Enhancement: A Starting Decision Framework for Technology Initiatives in R&D

Leveraging advanced technology like generative AI through digital transformation (not digital enhancement) is how to get the biggest returns in scientific R&D.

Read More

Digital Transformation in Practice

There is much more to digital transformation than technology, and a holistic strategy is crucial for the journey.

Read More

Leveraging AI for More Efficient Research in BioPharma

In the rapidly-evolving landscape of drug discovery and development, traditional approaches to R&D in biopharma are no longer sufficient. Artificial intelligence (AI) continues to be a...

Read More

Utilizing LLMs Today in Industrial Materials and Chemical R&D

Leveraging large language models (LLMs) in materials science and chemical R&D isn't just a speculative venture for some AI future. There are two primary use...

Read More

Top 10 AI Concepts Every Scientific R&D Leader Should Know

R&D leaders and scientists need a working understanding of key AI concepts so they can more effectively develop future-forward data strategies and lead the charge...

Read More

Why A Data Fabric is Essential for Modern R&D

Scattered and siloed data is one of the top challenges slowing down scientific discovery and innovation today. What every R&D organization needs is a data...

Read More