1

In a similar style to this question about R, is there a way to determine whether a given MATLAB instance was launched by the user or whether it was spawned by the parallel toolbox scheduler?

Community
  • 1
  • 1
eykanal
  • 26,437
  • 19
  • 82
  • 113

1 Answers1

0

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

Pablo
  • 8,644
  • 2
  • 39
  • 29
  • 1
    I think you'd be better off using getCurrentTask rather than getCurrentWorker. getCurrentWorker only works on the job manager, not the other schedulers. – richardthe3rd Mar 28 '11 at 19:55