Invoke MATLAB in CI Environments
July 6, 2026 · View on GitHub
You can invoke MATLAB® in continuous integration (CI) pipelines in different ways depending on where you want MATLAB to run and how you want MATLAB to integrate with your pipeline. Choose an approach based on your use case.
| Use Case | Recommended Approach |
|---|---|
| Run MATLAB directly in CI. | CI Platform Integration for MATLAB |
| Run MATLAB on a custom runner setup. | Command-Line MATLAB (matlab -batch) |
| Run MATLAB without installing it. | Packaged MATLAB Artifacts (executables, Python® packages, and containers) |
| Run MATLAB remotely. | MATLAB Hosted on Server |
| Generate CI pipelines for Simulink®. | Advanced Simulink CI Workflows |
CI Platform Integration for MATLAB
MathWorks® provides CI integrations that can install MATLAB, configure products, and run MATLAB noninteractively on CI runners.
Use these integrations to run MATLAB on CI runners. For other platforms, use MATLAB from the command-line or the Dockerfile instead.
| CI Platform | Integration |
|---|---|
| Azure DevOps® | MATLAB Extension |
| Bamboo® | MATLAB Plugin |
| CircleCI® | MATLAB Orb |
| GitHub® Actions | MATLAB Actions |
| GitLab® CI/CD | MATLAB build Component |
| Jenkins® | MATLAB Plugin |
| TeamCity® | MATLAB Plugin |
To try these CI platform integrations, you can fork the ci-configuration-examples repository and install the MATLAB CI plugin on your CI platform.
To standardize your MATLAB builds and support incremental builds, you can combine these integrations by using the MATLAB build tool.
For more information, see Continuous Integration with MATLAB on CI Platforms.
Command-Line MATLAB
You can use the matlab command with the -batch option in your CI pipeline configuration file to execute scripts, functions, and statements.
For example, this command runs the code in a file named myscript.m:
matlab -batch "myscript"
MATLAB terminates automatically with the exit code 0 if the code executes successfully without generating an error. Otherwise, MATLAB terminates with a nonzero exit code.
Consider using matlab -batch when:
- Your CI platform does not have a CI platform integration for MATLAB.
- You use custom runners.
- You want to invoke MATLAB using a simple command-line call.
As alternatives to using matlab -batch:
- For scaled workflows, you can use the
matlab-batchexecutable. - You can call MATLAB from other languages in CI by using the associated external language interface, but these integrations typically require a specific licensing model and do not support MATLAB batch token licensing.
Packaged MATLAB Artifacts
When you package MATLAB artifacts, you build once with MATLAB and then run the resulting artifacts without installing MATLAB.
Consider using a packaged MATLAB approach when:
- You want minimal dependencies on your CI runners.
- You run the same workflow repeatedly.
The packaged MATLAB approach:
- Applies licensing at build time
- Does not require MATLAB installation on CI runners
You can build and distribute MATLAB code as deployable artifacts, including:
- Standalone executables — For more information, see Get Started with MATLAB Compiler.
- Python packages — For more information, see Python Package Integration. For the differences between a compiled Python package and calling MATLAB from Python, see Differences Between MATLAB Engine API for Python and MATLAB Compiler SDK.
- Docker® images with MATLAB Runtime — For more information, see Package MATLAB Standalone Applications into Docker Images.
For more information about creating deployable applications from MATLAB code using MATLAB Compiler, see Standalone Applications.
MATLAB Hosted on Server
You can run MATLAB outside of your CI platform by invoking MATLAB remotely and using CI to orchestrate execution. You can use MATLAB Production Server™ to expose MATLAB functionality using REST or gRPC APIs.
Consider using MATLAB Production Server when:
- You have multiple pipelines that share MATLAB workloads.
- You need more control over scaling.
- You have a platform team or service team that owns MATLAB execution separately from CI.
The server approach:
- Allows the CI platform to call an API instead of launching MATLAB directly
- Centralizes execution and scaling to a MATLAB instance that runs elsewhere
- Separates the MATLAB workflows for a pipeline
- Separates MATLAB execution from CI
For more information, see MATLAB Production Server.
Advanced Simulink CI Workflows
If your team uses Simulink, the CI/CD Automation for Simulink Check support package can simplify CI setup and integration.
The support package can:
- Generate CI pipeline configuration files (YAML, Jenkinsfile) for certain CI platforms.
- Run incremental builds using a
processmodel.mfile. - Reduce manual pipeline setup and maintenance.
For more information, see:
- Azure DevOps Integration Guide
- GitHub Actions Integration Guide
- GitLab CI/CD Integration Guide
- Jenkins Integration Guide
Alternatively, you can use matlab -batch to call the runprocess function as shown in Other Platforms.
See Also
- Install MathWorks Products in CI Environments
- License MathWorks Products in CI Environments
- Run MATLAB in Containers
Copyright 2026 The MathWorks, Inc.