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

Prospecting for Data on the Web

Introduction At Enthought we teach a lot of scientists and engineers about using Python and the ecosystem of scientific Python packages for processing, analyzing, and…

Read More

True DX in the Pharma R&D Lab Defined by Enthought

Enthought’s team in Japan exhibited at the Pharma IT & Digital Health Expo 2022 life sciences conference in Tokyo, to meet with pharmaceutical industry leaders…

Read More

Life Sciences Labs Optimize with New Digital Technologies and Upskilling

Labs are resetting the trajectory for drug development: reducing timelines from years to months; decreasing costs from billions to millions; and gaining an advantage by…

Read More

Configuring a Neural Network Output Layer

Introduction If you have used TensorFlow before, you know how easy it is to create a simple neural network model using the Keras API. Just…

Read More

No Zero Padding with strftime()

One of the best features of Python is that it is platform independent. You can write code on Linux, Windows, and MacOS and it works…

Read More

Digital Transformation of the Materials Science R&D Lab

“Digital transformation”, “machine learning”, and “artificial intelligence” are buzzwords heard in every industry, from the boardroom to the lab. We asked Dr. Michael Heiber, lead…

Read More

Got Data?

Introduction So, you have data and want to get started with machine learning. You’ve heard that machine learning will help you make sense of that…

Read More

Sorting Out .sort() and sorted()

Sorting Out .sort() and sorted() Sometimes sorting a Python list can make it mysteriously disappear.  This happens even to experienced Python programmers who use .sort()…

Read More

A Beginner’s Guide to Deep Learning

Deep learning. By this point, we’ve all heard of it. It’s the magic silver bullet that can fix any complex problem. It’s the special ingredient…

Read More

Takeaways from SEMICON West 2021

SEMICON West 2021 lived up to its status as the signature conference for the extended microelectronics supply chain. Business and technology leaders, researchers, and analysts…

Read More

Join Our Mailing List!

Sign up below to receive email updates including the latest news, insights, and case studies from our team.