Main Content

getCurrentWorker

Get worker object from current worker

    Description

    w = getCurrentWorker returns the current worker, as a parallel.Worker object. Use getCurrentWorker to get information from the worker during a computation, such as the worker host name.

    If getCurrentWorker is evaluated on a worker, w is a parallel.Worker object. Otherwise, w is an empty double.

    example

    Examples

    collapse all

    Use the Host property to find the host name of the current worker.

    On a worker, use getCurrentWorker to get the current worker object w.

    w = getCurrentWorker;

    Then, use the Host property to get the host name of the worker.

    host = w.Host;

    Output Arguments

    collapse all

    Worker object, specified as a parallel.Worker or empty double. When you use getCurrentWorker on a worker, w is the parallel.Worker object that the current worker is associated with. When you use getCurrentWorker on the client, w is an empty double.

    Data Types: parallel.Worker

    Version History

    Introduced before R2006a