Deploy Dashboard Panel as App
With the Simulink® Compiler™ and MATLAB Runtime (MATLAB Compiler), you can deploy a dashboard panel, packaged with the model to which the panel connects, as a standalone desktop app or a web app that runs with the MATLAB® Web App Server™. You can use the app to operate the controls and monitor the displays on the panel independent of Simulink.
The panel is visible in the app, and you can interact with the panel. From the app, you can start, pause, and stop the simulation. The model to which the panel connects is not visible. You can only interact with the model through the panel.
Check Deployment Limitations
These actions are not supported:
Deployment from MATLAB Online™
Deployment from a library model
Deployment of a panel that contains any of these blocks:
Dashboard Scope blocks
Callback Button blocks
Display blocks connected to a signal that is multidimensional
Deployment of a panel in a model that does not run in rapid accelerator mode.
To check whether the model runs in rapid accelerator mode, in the Simulink Toolstrip, on the Simulation tab, in the Simulate section, from the drop-down list, select
Rapid Accelerator
. Then, click Run. To make the panel deployable, resolve any errors the simulation throws.Note
Blocks from the Dashboard and Customizable Blocks libraries do not support streaming in rapid accelerator mode. The blocks being marked as unsupported during this process is not an error you need to resolve in order to make the panel deployable.
Deployment of a model with dependencies that are not on the MATLAB path and whose file path does not share a root with the model. For example, on Windows®, if a dependency is not on the MATLAB path and is located on a different drive than the model, the model is unable to deploy. If you have a dependency that is not on the MATLAB path and whose file path does not share a root with the model, try moving the dependency on the MATLAB path. If the file path of the dependency is hardcoded in the model, update the path to reflect the new location of the dependency.
Plan Ahead to Avoid Simulation Errors
Deploying a panel creates a copy of the model that contains the panel, loads the copy, and then closes the copy. As a result, during deployment, the copy runs any callback functions that would run if you were to load and then close the original model. The copy running the callbacks while the original model is open can cause the original model to throw errors when you try to simulate the model after you deploy the panel.
For example, if the model contains a callback that clears variables from the MATLAB workspace when the model closes, then during the deployment, when the copy of the model closes, the callback runs and clears the variables. Since the variables are the same for both the original model and the copy, if you then try to simulate the original model, it might throw an error because the callback cleared the variables that the model needs to run.
If you plan to simulate the model (the model you started with, not the app) after you deploy, then adjust the callbacks, the model, or your workflow after deployment to avoid errors during simulation. For example, depending on the model and the callbacks, you may be able to avoid simulation errors by closing and reopening the model after you deploy.
Deploy Panel as Standalone App
If you have the Simulink Compiler and MATLAB Runtime, you can deploy a panel as a standalone app that you run from an executable.
Deploy Panel
If the model that contains the panel is not open, open the model.
If you docked the panel or opened the panel in a new window, return the panel to the canvas by clicking the Open in canvas button .
If the model is already open and has unsaved changes, save the model.
By default, the app deploys to the current folder. Deploying to the current folder means that the software saves all files output during simulation to the current folder. Specifically, in the current folder, the software creates a subfolder named after the app. The software saves all temporary files output during deployment in the current folder, and all non-temporary files in the subfolder. If you plan to deploy to the current folder, check that the current folder has write permissions. If the folder does not have write permissions, navigate to a folder that has write permissions.
To change the deployment folder, in the model, select the panel. In the Property Inspector, on the Parameters tab, expand the Deployment Settings section. In the Output Folder text box, enter a new file location. Alternatively, click Browse and select a new file location.
Also by default, the app title is the name of the panel you deploy. To change the app title, enter a new title in the Title text box.
To start the deployment, select the panel you want to deploy. In the Simulink Toolstrip, on the Panels tab, in the Deploy section, expand Deploy Panel and select Standalone Desktop App.
If the person who will run the app has internet access, then in the toolstrip of the Application Compiler window, in the Packaging Options section, select Runtime downloaded from web app. If not, then select Runtime included in package.
In the toolstrip of the Application Compiler window, click Package.
In the Package window that appears, select Open output folder when process completes. If the output folder does not open automatically when the packaging process completes, click the link to open the output folder.
Run App
Running the deployed app requires MATLAB Runtime. To install MATLAB Runtime, run the executable located in the folder to which you deployed, in the
for_redistribution
folder.
To run the app, run the executable in the
for_redistribution_files_only
folder (on Linux®, run the shell script, and on macOS, run the application).
Deploy Panel as Web App
If you have the Simulink Compiler and the MATLAB Web App Server, you can deploy the panel as a web app that you run in a Chrome® browser.
Deploy App
If the model that contains the panel is not open, open the model.
To deploy a panel as a web app, you must deploy on the operating system that supports the server you want to deploy to. For example, if you want to deploy to a Linux Web App server, you must deploy on Linux.
If you docked the panel or opened the panel in a new window, return the panel to the canvas by clicking the Open in canvas button .
If the model is already open and has unsaved changes, save the model.
By default, the app deploys to the current folder. Deploying to the current folder means that the software saves all files output during simulation to the current folder. Specifically, in the current folder, the software creates a subfolder named after the app. The software saves all temporary files output during deployment in the current folder, and all non-temporary files in the subfolder. If you plan to deploy to the current folder, check that the current folder has write permissions. If the folder does not have write permissions, navigate to a folder that has write permissions.
To change the deployment folder, in the model, select the panel. In the Property Inspector, on the Parameters tab, expand the Deployment Settings section. In the Output Folder text box, enter a new file location. Alternatively, click Browse and select a new file location.
Also by default, the app title is the name of the panel you deploy. To change the app title, enter a new title in the Title text box.
To start the deployment, select the panel you want to deploy. In the Simulink Toolstrip, on the Panels tab, in the Deploy section, expand Deploy Panel and select Web App.
In the Packaging Progress window, select Open output folder upon completion.
Run App
Running the web app requires the MATLAB Web App Server. Install and start the web app server. For information about how to complete these actions, see Install or Uninstall MATLAB Web App Server Product (MATLAB Web App Server).
For information about how to run the web app, see Run Web App (MATLAB Web App Server). Run the web app in a Chrome browser.
Run Simulation from Panel
You can take these actions using the toolbar in the app.
Action | Toolstrip Button |
---|---|
Run simulation. | |
Pause simulation. | |
Stop simulation. | |
Set simulation pacing. For more information about simulation pacing, see Simulation Pacing Options. Setting simulation pacing is not supported during simulation. |