MATLAB: How to retrieve startup options of current matlab session

nodesktop startup

Hi, I want to change the behavior of a function it is running in command line only mode (-nodesktop startup option).
How can I know what startup options were used in the session were the function is running?
Thanks

Best Answer

Camilo - you can try using the usejava command to determine if a specific feature is available. With the option 'desktop', you can determine if the MATLAB interactive desktop is running or not.
For example, if using MATLAB normally (not launching from command line), execute the statement from the Command Window
isDesktopAvail = usejava('desktop');
sets the isDesktopAvail flag to one/true.
If launching MATLAB from the command line with
./matlab -nodesktop -nosplash
then executing the same command (from above) sets isDesktopAvail to 0/false.
This was tested with R2014a on OS X 10.8.5.