Is it possible to programmatically check whether MATLAB has been started with the "-nodisplay" option?
Show older comments
I have a program that needs to behave differently depending on whether MATLAB has a display or not. However, I cannot determine a way to programmatically check this.
The reason I need to do this is that I sometimes start MATLAB in batch mode from a shell script, for testing my programs.
Accepted Answer
More Answers (1)
Jan
on 29 Jul 2020
See also: https://www.mathworks.com/matlabcentral/answers/407059-if-matlab-desktop-elseif-matlab-nodesktop :
usejava('desktop')
or
java.lang.System.getProperty( 'java.awt.headless' )
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!