MATLAB Answers

Is there a script function or variable to determine if running on desktop?

1 view (last 30 days)
Craig Anderson
Craig Anderson on 21 Mar 2018
Answered: Benjamin Großmann on 24 Apr 2018
I have a script which I run from the Matlab desktop/display. I wish to run it from the Linux command line without the desktop (using the -nodesktop option). But there are functions in the script which exit if running without the Matlab desktop. Is there a way in the script to not execute those commands if not running on the desktop?

  2 Comments

Stephen Cobeldick
Stephen Cobeldick on 21 Mar 2018
"...there are functions in the script which exit if running without the Matlab desktop."
Have you tried a judicious application of try and catch ?

Sign in to comment.

Answers (1)

Benjamin Großmann
Benjamin Großmann on 24 Apr 2018
From the documentation:
USED = desktop('-inuse') % returns whether or not the Desktop is currently in use. It does not start the Desktop.
This function returns a logical value which you could use for some conditional statements.

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags


Translated by