How to retrieve startup options of current matlab session?

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

 Accepted 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.

2 Comments

In the thread you mention they say that this option would fail to give the right answer under -nodesktop option only. But I just tested it (in matlab version 8.1.0.604 (R2013a)), and it works perfectly. Thanks a lot!
Hi, I'm still interested in the original question, i.e. is there a way to find what startup parameters were used for the session in question. Specifically the -r arguments to be executed at startup. The reason is that another tool (Carsim) opens Matlab in a specific way and I would like to perform some actions if so.
Or I realized that Carsim is accessing Matlab through a COM server. A related issue is that I would like to have my current Matlab session as the server, rather than that a new Matlab instance is started that acts as server. Is there any way to control that?

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!