Using MATLAB with Other Programming Languages

With MATLAB®, you can reuse legacy code written in another programming language, create MATLAB powered responsive web sites, or program hardware using error-free embedded C-code generated directly from MATLAB. Teams that use different programming languages can work together, spending more time developing products and less time recoding in another language.

Calling MATLAB from Another Language

With MATLAB Engine APIs, you can use MATLAB from within another programming environment. The APIs enable execution of MATLAB commands from within your programming language without starting a desktop session of MATLAB. MATLAB Engine APIs are available for:

Explore details on calling MATLAB with these languages.

Calling MATLAB from  Another Language
Using Code Written  in Another Language Within MATLAB

Calling Libraries Written in Another Language from MATLAB

If you have functions and objects in another programming language, you can call them from MATLAB. The MATLAB documentation Calling External Interfaces explains how to call these components. 

Converting MATLAB Code to C/C++

You can convert your MATLAB algorithms into C/C++ code using MATLAB Coder™. The generated C code is readable and portable, with support for most of the MATLAB language and a wide range of toolboxes. For more details, explore MATLAB Coder, or watch the webinar MATLAB to C/C++ Made Easy (47:38).

You can use Embedded Coder® to extend the capabilities of MATLAB Coder, and use Simulink Coder™ to generate code from Simulink.

The choice between using MATLAB Coder and MATLAB Compiler SDK for C/C++ integration depends on your workflow and requirements, including whether you need portable, standalone code. View guidance to help you choose the best solution.

Converting MATLAB  Code to C/C++
Packaging MATLAB Programs as Software Components

Packaging MATLAB Programs as Software Components

MATLAB programs can be packaged into language-specific software components so you can integrate them with popular programming languages. These components can be integrated with custom applications and deployed to desktop, web, and enterprise systems.

This option is useful if your end user does not have MATLAB. The software components are created using MATLAB Compiler SDK, and can be distributed royalty-free.

The following language components can be generated from MATLAB code:

Using Multiple Integration Approaches

While each of the above sections describe different possibilities for integrating MATLAB with other programming languages, many users combine more than one approach to create a hybrid solution for their needs. While we provide multiple options for you to accomplish complex workflows, MathWorks Consulting Services can also further help you with integration projects.