| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Parallel Computing Toolbox |
| Contents | Index |
| Learn more about Parallel Computing Toolbox |
worker = getCurrentWorker
worker | The worker object that is currently evaluating the task that contains this function. |
worker = getCurrentWorker returns the worker object representing the session that is currently evaluating the task that calls this function.
If the function is executed in a MATLAB session that is not a worker or if you are using a third-party scheduler instead of a job manager, you get an empty result.
Create a job with one task, and have the task return the name of the worker that evaluates it.
jm = findResource('scheduler','type','jobmanager', ...
'name','MyJobManager','LookupURL','JobMgrHost');
j = createJob(jm);
t = createTask(j, @() get(getCurrentWorker,'Name'), 1, {});
submit(j)
waitForState(j)
get(t,'OutputArgument')
ans =
'c5_worker_43'
The function of the task t is an anonymous function that first executes getCurrentWorker to get an object representing the worker that is evaluating the task. Then the task function uses get to examine the Name property value of that object. The result is placed in the OutputArgument property of the task.
getCurrentJob, getCurrentJobmanager, getCurrentTask, getFileDependencyDir
![]() | getCurrentTask | getDebugLog | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |