How to retrieve startup options of current matlab session?
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Geoff Hayes
2014-10-5
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.
See also the question http://www.mathworks.com/matlabcentral/answers/26110-how-to-programmatically-determine-if-in-headless-mode for another alternative.
2 个评论
Mats Widmark
2023-8-17
编辑:Mats Widmark
2023-8-17
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?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!