fetchOutputs
Retrieve output arguments from all tasks in job
Syntax
Description
retrieves the output arguments contained in the tasks of a finished job.data
= fetchOutputs(j
)
When you retrieve outputs from a job you create usingcreateJob
orcreateCommunicatingJob
, each row of them
-by-n
cell arraydata
contains the output arguments for each of them
tasks in the job. Each of the rows indata
hasn
elements, wheren
is the greatest number of output arguments from any one task in the job. Then
elements of a row are arrays containing the output arguments from that task. If a task has less thann
output arguments, the excess elements in the row for that task are empty.
When you retrieve outputs from a job you create usingbatch
:
If you create the batch job using the
fcn
syntax and specifyN
outputs,data
is a1
-by-N
cell array.If you create the batch job using the
script
orexpression
syntaxes,data
is a1
-by-1
cell array containing a structure scalar. If you specify thePool
argument when you create the batch job, the structure scalar contains the workspace of the worker that acts as the client. Otherwise, the structure scalar contains the workspace of the worker that runs the job.
The output data for a job is stored in the location given by theJobStorageLocation
property of the cluster that the job runs on. When you runfetchOutputs
, the output data is not removed from theJobStorageLocation
. To remove the output data, use thedelete
function to remove individual tasks or entire jobs.
ThefetchOutputs
function throws an error if:
The
State
property of the jobj
is not'finished'
.The
State
property of the jobj
is'finished'
and one of the tasks given by theTasks
property of the jobj
encountered an error.
Tip
To see if any of the tasks on the jobj
failed after encountering an error, check ifj.Tasks.Error
is empty. If the returned array is empty, none of the tasks on the jobj
encountered any errors.
If some tasks completed successfully, you can use theOutputArguments
property of a task to access the output arguments of that task directly.