MATLAB

Using MATLAB and Python Resources

Learn how to combine MATLAB and Python for your projects and AI applications. For Python users, get tips, explore MATLAB language highlights, compare data types, and more.

Getting Started with MATLAB and Python

You don’t have to choose between programming languages. Take advantage of both languages by using them together.

Connecting MATLAB and Python

MATLAB provides built-in support for Python®, allowing MATLAB code to interact with Python scripts and functions directly, and vice versa.

Once you have confirmed your system configuration, there are several ways to interact with Python. For example, you can call Python functions from the MATLAB command line.

x = py.math.sqrt(42)

Using MATLAB with Python

Engineers use MATLAB with Python for:

  • Collaborating with other teams that use different languages, making it easier to prototype, test, and integrate algorithms and systems  
  • Accessing a large community of both MATLAB and Python users who share algorithms, examples, and teaching materials
  • Integrating MATLAB and Python with other languages and tools, such as C++, Java®, TensorFlow™, and Apache® Parquet

Calling Python from MATLAB

You can use built-in Python libraries and user-created functions and scripts directly from the MATLAB environment and pass data between MATLAB and Python.

Calling MATLAB from Python

The MATLAB Engine API for Python enables you to use interactive apps and advanced scientific and engineering functionality in MATLAB and Simulink from within Python.

Exchanging Deep Learning Models

You can import PyTorch®, TensorFlow, and ONNX models into MATLAB, and export networks to TensorFlow and ONNX. Also, you can use imported networks with MATLAB built-in tools for explainable AI and verification, simulation with Simulink, automatic code generation, and more.

Deploying and Sharing

You can package and share MATLAB programs to integrate with Python applications or deploy them to various cloud and hardware platforms.

Using MATLAB (for Python Users)

Get the most out of MATLAB as a Python user.

Integrating with Jupyter and VSCode

You can access MATLAB from Jupyter or Visual Studio Code by using your IDE of choice to interact with MATLAB apps and functionality. 

Learning MATLAB Basics

You can learn how to use MATLAB most effectively with cheat sheets, interactive courses, and documentation.

Exploring Advanced Engineering

MATLAB can help you with your advanced mathematics and domain-specific engineering needs. You can get started with these topics using many detailed examples and short interactive courses on image and signal processing, physical and system modeling, control design and more.