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 CaseRecommended 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 PlatformIntegration
Azure DevOps®MATLAB Extension
Bamboo®MATLAB Plugin
CircleCI®MATLAB Orb
GitHub® ActionsMATLAB Actions
GitLab® CI/CDMATLAB 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-batch executable.
  • 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:

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.

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.m file.
  • Reduce manual pipeline setup and maintenance.

For more information, see:

Alternatively, you can use matlab -batch to call the runprocess function as shown in Other Platforms.

See Also


Copyright 2026 The MathWorks, Inc.