This guide shows how to run the MATLAB® desktop on Databricks®.
-
Ensure that your administrator has followed the instructions to Set Up MATLAB on Databricks (GitHub).
-
Follow the instructions to Import this Repository into Databricks (GitHub).
Create the cluster where you want to run MATLAB. MATLAB is unable to run on serverless clusters, so you must create a classic compute cluster:
- Log in to your Databricks Workspace.
- Navigate to Compute and click Create compute.
- Under General > Policy, select the MATLAB policy that your administrator should have set up for you.
- Click Create.
To start MATLAB, follow these steps:
- In your Databricks workspace, navigate to the folder where you imported this repository. Open resources > notebooks > Connect_to_MATLAB.ipynb.
- From the notebook toolbar, use the Compute Selector (Databricks) to select the cluster you set up earlier.
- Run the code cell.
- You see the Connect to MATLAB user interface in your notebook:
-
To start MATLAB, click Add. A new MATLAB session starts on the cluster's driver node. A link appears in the log window. Click Open MATLAB to open the MATLAB session in a new browser tab.
If you start multiple MATLAB sessions, these will run on the same node.
If you restart your notebook session or detach your notebook from the cluster, your MATLAB session will shut down.
Licensing: Your administrator might have already specified your license details in the Dockerfile or compute policy they used in the workflow Set Up MATLAB on Databricks. Otherwise, on your first login to MATLAB you will be prompted to enter your license details. For assistance, contact your administrator.
-
To connect to an existing MATLAB instance, select it from the Available MATLAB Instances window, then click Connect.
-
To stop a running MATLAB instance, select it and click Stop.
Your administrator might have installed certain MATLAB toolboxes when they set up MATLAB for you. To see which toolboxes they installed, run ver in MATLAB.
If you want to use additional toolboxes but do not have internet access, contact your administrator and request them to add the required toolboxes to the Docker image they used to Set Up MATLAB on Databricks.
If you do have internet access, you can install the toolboxes yourself:
-
Download the
mpm_input.txtfile that corresponds to your MATLAB release from MPM Input Files (GitHub). In the downloaded file, under theProductssection, uncomment the lines for the toolboxes you want to install. Save the file. -
Expand the Configuration and Toolboxes section in the notebook. Under Install Additional MathWorks Toolboxes, click Upload to select and upload your
mpm_input.txtfile from the previous step. -
When the file validation is complete, click Install to install the toolboxes. Progress is displayed in the log window.
-
Start a new MATLAB session to access the new toolboxes.
To investigate errors and view details of your environment, run diagnostics. Expand the Diagnostics section in the notebook, and click Run Diagnostics.
To run workflows for using Spark, or scaling MATLAB code in Databricks, you need to install a package called the MATLAB Interface for Databricks. (If you only want to run MATLAB interactively, you do not need the package and can skip this step.)
To install the package, you have two options:
-
Ask your administrator if they followed the steps to Download MATLAB Interface for Databricks. If so, they can provide you the path to the volume where the package is stored. Expand the MATLAB Interface for Databricks section in the notebook, insert the path in the Install Location field, then click Install.
-
If your administrator has not downloaded the package for you, you can download it yourself (which requires Internet access). Click Download. In the Install Location field, you will see the path where the package has been downloaded. Click Install.
When you install the package successfully, you see "Installation complete." printed in the log window.
Now you can use MATLAB in your browser. You can also:
-
Query Data in Databricks from MATLAB
- Run SQL queries on a Databricks cluster or SQL warehouse using Database Toolbox™.
-
Scale MATLAB Workflows on Databricks
-
Scale MATLAB code interactively on a single node using Parallel Computing Toolbox™.
-
Perform Spark operations in MATLAB on a single node, for quick development and testing.
-
Combine Spark operations with compiled MATLAB or Simulink code for quick development in MATLAB, across multiple nodes.
-
Scale production workflows with compiled MATLAB or Simulink code for frequent and complex computations, across multiple nodes.
-
When you use MATLAB on Databricks, these limitations apply:
- Workspace files have a maximum size of 500MB.
- Do not use DBFS because it is deprecated and not recommended by Databricks.
- Volumes do not support non-sequential writes. This means that most MATLAB IO operations, e.g.
save()orsavefig(), for complex file types will not reliably write to a/Volumespath. To work around this issue make the initial save to a temporary file in/local_disk0/<username>, a conventional filesystem on the node, and from there move the file to/Volumesusingcopyfile()ormovefile(). Alternatively, use thedatabricks.FilesAPI. - You lose all locally stored files when the cluster terminates or is deleted. These files include files in
/home/<username>,/tmpand/local_disk0. To store files permanently, copy the files to/Workspaceor/Volumes, or commit them to source control.
For a complete set of limitations, see Workspace File Limitations (Databricks).
Copyright 2026 The MathWorks, Inc.



