Why do I get an error "Can't create UI because there is no display connection" when running certain Model Advisor checks on a headless Linux machine?

5 views (last 30 days)
I have a script that calls the Advisor.Application class to pass a JSON Config file and run the ModelAdvisor. Inside my JSON rules, I have a bunch of Simulink Design Verifier and Embedded Coder rules enabled. I'm running the scriptusing the command
matlab -batch "doModelAdvisorCheck"
to run matlab in batch mode.
However, the Model Advisor report contains a bunch of failures with the following description:
Error occurred during model compile.
Can't create UI because there is no display connection
Since I'm using MATLAB on a headless Continuous Integration Agent, how do I get around this UI failure if I have no display/monitor connected to that machine? 
I try to -batch and -nodesktop startup options, but to no avail.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 26 Oct 2023
Edited: MathWorks Support Team on 26 Oct 2023
The issue occurs during model compilation when the checks are run using Advisor.Application()
Our recommendation is to use
ModelAdvisor.run()
instead of the app. The ModelAdvisor.run API is a more stable option for this purpose.
For example:
 results = ModelAdvisor.run(myModelName,'Configuration',myConfigFile);
 myMAResultStruct = struct(...
            'Passed',results{1}.numPass,...
            'Failed',results{1}.numFail,...
            'NotRun',results{1}.numNotRun,...
            'Warning',results{1}.numWarn,...
            'Justified',results{1}.numJustified);
Please note:
The use of Embedded Coder and Simulink Design Verifier in automation servers requires the use of the Client Access License. More information is available here:

More Answers (0)

Categories

Find more on Simulink Environment Customization in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!