Determine whether MATLAB was launched from OS GUI or as a Parallel Toolbox thread
In a similar style to this question about R, is there a way to determi开发者_如何学Gone whether a given MATLAB instance was launched by the user or whether it was spawned by the parallel toolbox scheduler?
Warning: untested code
This seems like it might do the trick:
if isempty(getCurrentWorker)
% Do things if launched as a worker
else
% Do things if launched in a GUI session
end
Here's the reference: http://www.mathworks.com/help/toolbox/distcomp/getcurrentworker.html
精彩评论