This repository shows how to run MATLAB® in GitHub™ Codespaces, so you can quickly start a development environment for developing the MATLAB code hosted in your Github repository.
- When Should I Use MATLAB in Codespaces?
- Choose a Configuration
- Use MATLAB in Codespaces
- Related Links
A codespace (GitHub Docs) is a development environment you run in the cloud. If you own a Github repository hosting MATLAB code, users of your repository can use Codespaces to:
- Configure a consistent and customizable development environment.
- Run MATLAB along with other software or programming languages.
- Use Git to contribute back to your repository.
Codespaces run in Docker containers called development containers, or dev containers (GitHub Docs). You can customize how MATLAB is installed in your codespace by modifying the configuration file of the dev container, named devcontainer.json
. Choose the configuration that corresponds to your desired use case.
Use Case | Recommendation | Start Codespace Using Recommended Configuration |
---|---|---|
Use MATLAB only | Use a prebuilt MATLAB Container on Docker Hub. Configure your codespace using this devcontainer.json. |
|
Customize MATLAB installation with specific toolboxes or other software | Create a custom MATLAB container image using MATLAB Dockerfile. You can see an example Dockerfile in the .devcontainer/using-matlab-dockerfile folder. Configure your codespace using this devcontainer.json. |
|
Add MATLAB to an existing devcontainer configuration | Use the MATLAB Feature for Devcontainers. Configure your codespace using this devcontainer.json. |
Use your MATLAB codespace to:
- Run & Debug
.m
files in VS Code - Run MATLAB code in Jupyter Notebooks in both VS Code and JupyterLab
- Switch to the MATLAB IDE to use more MATLAB features.
By default, your MATLAB codespace starts in a Visual Studio Code environment, and MATLAB opens in a browser tab.
For details on using MATLAB in VS Code in your codespace, see What Can I Do With MATLAB in VS Code?
For details on using MATLAB in JupyterLab in your codespace, see What Can I Do With MATLAB in JupyterLab?
Once you have MATLAB set up in your codespace, you can use VS Code to:
-
Run & Debug MATLAB files in the VS Code editor.
For more information, see MATLAB Extension for Visual Studio Code.
-
Access MATLAB in a browser tab.
For more information on using MATLAB in the browser, see MATLAB Proxy.
-
Run MATLAB code in Jupyter Notebooks within VS Code.
You can run MATLAB code in Jupyter Notebooks, within the VS Code environment. For more information about VS Code support for Jupyter Notebooks, see Jupyter Notebooks in VS Code (VS Code).
The configurations in Choose a Configuration enable you to run MATLAB in JupyterLab as well as VS Code:
After opening JupyterLab in your codespace, you can:
- Overview of Codespaces (GitHub)
- Development Container Features (GitHub)
- Development Container Specification (Microsoft®)
- Setting Your Default Editor for Codespaces (GitHub)
- Run Dev Containers in VS Code (VS Code Docs)
Copyright 2024-2025 The MathWorks, Inc.