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.

MATLAB provides a flexible, two-way integration with other programming languages including:


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 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. As of R2015b, you can call the following program components within MATLAB:


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 Made Easy.

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

If you are working with a programming language other than C/C++, you can use MATLAB code generated using MATLAB Compiler SDK™. 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.


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.