How to Publish Simulink Model Comparisons Without a Display in Linux?

조회 수: 15 (최근 30일)
When I attempt to publish a simulink model comparison in an Ubuntu CICD pipeline (Gitlab), I receive incomplete .html files in the output folder and the following error message:
"Error using slxmlcomp.SimulinkModelComparison/publish. Printing is not supported in -nodisplay mode."
My .yml file's job uses the command
matlab -batch "mySlxComparisonScript"
to call the visdiff and publish functions:
comparison = visdiff('target.slx', 'source.slx');
publish(comparison, Name='foo', OutputFolder="bar/");
When I run the same batch command on my local Windows machine, the comparison reports are published as expected without errors. This may mean that the publish behavior is different in Linux vs Windows. I cannot find any MathWorks documentation for slxmlcomp objects, SimulinkModelComparison objects, or using the publish command for these objects. Any workarounds, help, or insights are appreciated.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2023년 5월 2일
Before R2023a, Simulink requires a display to generate images that show which blocks are modified in the changed models. This is why it is working on your Windows machine but not in your GitLab runner. GitLab runners often do not have displays by default. Two possible options for you to make progress are
1) In R2023a a new setting was introduced to disable generation of model screenshots so that the change report can be generated without a display. See the Simulink release notes here: 
2) The display does not need to be a physical display, it can be a virtual one too. You could use a command such as "xvfb-run" on Linux to run the report generation command with a virtual display in your CI/CD Gitlab runner.  The following would work: 
xvfb-run matlab -batch "generateDiffReports('$1', $2, $3, '$4')"
where "generateDiffReports" is your diff report generation script. 

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Report Generator에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by