PDA

查看完整版本 : 确定MATLAB是从OS GUI启动还是作为并行工具箱线程启动


poster
2019-12-14, 20:46
与关于R的问题 (https://stackoverflow.com/questions/2020790/r-script-determine-whether-the-script-is-run-in-the-gui-or-from-command-line)类似,有没有办法确定给定的MATLAB实例是由用户启动的还是由并行工具箱调度程序生成的?



回答:

警告:未经测试的代码

这似乎可以解决问题:

if isempty(getCurrentWorker) % Do things if launched as a worker else % Do things if launched in a GUI session end 这是参考: http (http://www.mathworks.com/help/toolbox/distcomp/getcurrentworker.html) : //www.mathworks.com/help/toolbox/distcomp/getcurrentworker.html (http://www.mathworks.com/help/toolbox/distcomp/getcurrentworker.html)



更多&回答... (https://stackoverflow.com/questions/5462518)