I would like to use questdlg within a Matlab application to prompt user feedback. If no display is available (e.g. over a non-forwarded ssh session or if Matlab is started with -nodisplay), questdlg fails (see below). Is there any way to determine if a display is available from within Matlab code so that I can fall back to a text-based alternative?
If Matlab is started with the -nodisplay option, qusetdlg produces the following output and “hangs” Matlab (in uiwait). Although the user can use Ctl-C to escape, there’s no indication of this option and a naive user might conclude that Matlab was truly hung:
>> questdlg('test','test')
Warning: This functionality is no longer supported under the -nodisplay and
-noFigureWindows startup options. For more information, see "Changes to
-nodisplay and -noFigureWindows Startup Options" in the MATLAB Release Notes.
To view the release note in your system browser, run
web('http://www.mathworks.com/access/helpdesk/help/techdoc/rn/br5ktrh-1.html#br5ktrh-3',
'-browser')
> In uitools/private/warnfiguredialog at 19
In dialog at 37
In questdlg at 117
Warning: This functionality is no longer supported under the -nodisplay and
-noFigureWindows startup options. For more information, see "Changes to
-nodisplay and -noFigureWindows Startup Options" in the MATLAB Release Notes.
To view the release note in your system browser, run
web('http://www.mathworks.com/access/helpdesk/help/techdoc/rn/br5ktrh-1.html#br5ktrh-3',
'-browser')
> In uitools/private/warnfiguredialog at 19
In uiwait at 41
In questdlg at 378
First of all, here is a list of relevant startup options, along with the operating system on which they are supported (otherwise they are ignored and have no effect):
-nojvm[UNIX] : start without JVM, anything that requires Java fails (including Handle Graphics functionality)-nodisplay[UNIX]: does not use X-Window display, ignores$DISPLAYenvironment variable-noFigureWindows[ALL] : headless mode, no figure will be shown-nodesktop[ALL] : IDE not started, command prompt insteadSince I only have access to a Windows install of MATLAB, I would be thankful If someone can replicate the following experiments on UNIX, by starting MATLAB with the
-nodisplayoption, or runing without theDISPLAYenvironment variable set, in combination with the-nodisplayand-nojvmoptions.matlab -nodesktop
matlab -noFigureWindows
matlab -nodesktop -noFigureWindows
In conclusion, this is the test I would use to get consistent results across platforms:
Some references:
which -all warnfiguredialog.m