https://github.com/mathworks-ref-arch/matlab-codespaces
This repository show different ways you can configure your dev containers to run MATLAB in codespaces.
https://github.com/mathworks-ref-arch/matlab-codespaces
codespaces matlab
Last synced: 9 months ago
JSON representation
This repository show different ways you can configure your dev containers to run MATLAB in codespaces.
- Host: GitHub
- URL: https://github.com/mathworks-ref-arch/matlab-codespaces
- Owner: mathworks-ref-arch
- License: other
- Created: 2024-07-04T04:34:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-24T10:01:59.000Z (11 months ago)
- Last Synced: 2025-03-27T09:23:37.991Z (10 months ago)
- Topics: codespaces, matlab
- Language: Dockerfile
- Homepage:
- Size: 10.5 MB
- Stars: 8
- Watchers: 7
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Run MATLAB in GitHub Codespaces
This repository shows how to run MATLAB® in [GitHub™ Codespaces](https://github.com/features/codespaces), so you can quickly start a development environment for developing the MATLAB code hosted in your Github repository.
## Table of Contents
- [When Should I Use MATLAB in Codespaces?](#when-should-i-use-matlab-in-codespaces)
- [Choose a Configuration](#choose-a-configuration)
- [Use MATLAB in Codespaces](#use-matlab-in-codespaces)
- [What Can I Do With MATLAB in VS Code?](#what-can-i-do-with-matlab-in-vs-code)
- [What Can I Do With MATLAB in JupyterLab?](#what-can-i-do-with-matlab-in-jupyterlab)
- [Related Links](#related-links)
## When Should I Use MATLAB in Codespaces?
A [codespace (GitHub Docs)](https://docs.github.com/en/codespaces/overview) 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.
## Choose a Configuration
Codespaces run in Docker containers called development containers, or [dev containers (GitHub Docs)](https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers). 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](https://hub.docker.com/r/mathworks/matlab).
Configure your codespace using this [devcontainer.json](.devcontainer/devcontainer.json).|[](https://github.com/codespaces/new/mathworks-ref-arch/matlab-codespaces?template=false&devcontainer_path=.devcontainer%2Fdevcontainer.json)|
|Customize MATLAB installation with specific toolboxes or other software|Create a custom MATLAB container image using [MATLAB Dockerfile](https://github.com/mathworks-ref-arch/matlab-dockerfile). You can see an example Dockerfile in the `.devcontainer/using-matlab-dockerfile` folder.
Configure your codespace using this [devcontainer.json](.devcontainer/using-matlab-dockerfile/devcontainer.json).|[](https://github.com/codespaces/new/mathworks-ref-arch/matlab-codespaces?template=false&devcontainer_path=.devcontainer%2Fusing-matlab-dockerfile%2Fdevcontainer.json)|
|Add MATLAB to an existing devcontainer configuration|Use the [MATLAB Feature for Devcontainers](https://github.com/mathworks/devcontainer-features/tree/main/src/matlab).
Configure your codespace using this [devcontainer.json](.devcontainer/using-devcontainer-feature/devcontainer.json).|[](https://github.com/codespaces/new/mathworks-ref-arch/matlab-codespaces?template=false&devcontainer_path=.devcontainer%2Fusing-devcontainer-feature%2Fdevcontainer.json)||
## Use MATLAB in Codespaces
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](https://code.visualstudio.com/) 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?](#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?](#what-can-i-do-with-matlab-in-jupyterlab)
### What Can I Do With MATLAB in VS Code?
Once you have MATLAB set up in your codespace, you can use VS Code to:
1. **Run & Debug MATLAB files in the VS Code editor.**

For more information, see [MATLAB Extension for Visual Studio Code](https://github.com/mathworks/MATLAB-extension-for-vscode).
2. **Access MATLAB in a browser tab.**

For more information on using MATLAB in the browser, see [MATLAB Proxy](https://github.com/mathworks/matlab-proxy).
3. **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)](https://code.visualstudio.com/docs/datascience/jupyter-notebooks).

### What Can I Do With MATLAB in JupyterLab?
The configurations in [Choose a Configuration](#choose-a-configuration) enable you to run MATLAB in JupyterLab as well as VS Code:

After opening JupyterLab in your codespace, you can:
1. **Run MATLAB code in Jupyter Notebooks.**

2. **Access MATLAB in a browser window.**

## Related Links
- [Overview of Codespaces (GitHub)](https://docs.github.com/en/codespaces/overview)
- [Development Container Features (GitHub)](https://github.com/devcontainers/features/)
- [Development Container Specification (Microsoft®)](https://containers.dev/implementors/spec/)
- [Setting Your Default Editor for Codespaces (GitHub)](https://docs.github.com/en/codespaces/setting-your-user-preferences/setting-your-default-editor-for-github-codespaces)
- [Run Dev Containers in VS Code (VS Code Docs) ](https://code.visualstudio.com/docs/devcontainers/create-dev-container)
---
Copyright 2024-2025 The MathWorks, Inc.
---