Unable to generate webview when -nodisplay option specified

8 views (last 30 days)
I am trying to generate a WebView in an environment where MATLAB is running without a display, i.e. launching MATLAB via:
matlab -nodisplay -nosplash -nodesktop create_webview
Where create_webview is just a wrapper around slwebview with my project's settings configured:
outfname = slwebview(systemp,'LookUnderMasks','all','FollowLinks','on',...
'FollowModelReference','on',... %Required for model reference
'SearchScope','All',... %Required to follow links within model reference
'ViewFile', false, 'ShowProgressBar', false);
The output of the script is:
Create the webview
Starting slwebview generation...
Error using slreportgen.webview.ui.Exporter/export
Simulink Web View is not supported in -nodisplay mode
Why must I have a display configured/enabled to generate the WebView? In Continuous Integration (CI) environments especially, it not possible to have a display configured.

Answers (1)

Karan Singh
Karan Singh on 4 Oct 2023
Hi Adam,
From what I understand, the goal is to understand why a display is required to generate the web view and why this limitation exists, particularly in CI environments where having a display is not feasible.
This is because the Simulink Web View relies on graphical capabilities to generate and display the web view of the Simulink model. In “-nodisplay” mode, MATLAB does not have access to a display system, which is required for generating the web view. This limitation is not specific to Continuous Integration (CI) environments but is inherent to MATLAB's design.
If you need to generate a web view without a display, you can consider alternative approaches. For example, you could generate a report or documentation using MATLAB's Report Generator tools (such as MATLAB Report Generator or MATLAB Publishing) and include relevant information about your Simulink model.
Attached below are some documentation links that you may find helpful:
Hope this helps!
Karan Singh Khati
  2 Comments
Adam Austin
Adam Austin on 4 Oct 2023
Creating model web views also requires having an active display. It seems that almost any interaction that involves Simulink requires a display of some sort.
Our team was able to build a container with a virtual frame buffer (xvfb) running in the background to provide the necessary display support to Simulink.
Nihar Gandhi
Nihar Gandhi on 4 Oct 2023
I've also had success creating a fake $DISPLAY using a vncserver on linux, which allows simulink to generate webviews.

Sign in to comment.

Tags

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!