Main Content

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.

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

  1. If the model that contains the panel is not open, open the model.

  2. If the model is already open and has unsaved changes, save the model.

  3. 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.

  4. 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.

  5. To start the deployment, in the Simulink Toolstrip, on the Panels tab, in the Deploy section, expand Deploy Panel and select Standalone Desktop App.

  6. 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.

  7. In the toolstrip of the Application Compiler window, click Package.

  8. 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.

    Package window with Open output folder when process completes selected

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).

Panel containing two Rocker Switch blocks, two Lamp blocks, and a Circular Gauge block deployed as a standalone app

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

  1. 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.

  2. If the model is already open and has unsaved changes, save the model.

  3. 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.

  4. 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.

  5. To start the deployment, in the Simulink Toolstrip, on the Panels tab, in the Deploy section, expand Deploy Panel and select Web App.

  6. 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.

ActionToolstrip Button
Run simulation.Run button
Pause simulation.Pause button
Stop simulation.Stop button
Set simulation pacing. For more information about simulation pacing, see Simulation Pacing Options. Setting simulation pacing is not supported during simulation.Simulation Pacing button

Related Topics