Quantcast

Documentation Center

  • Trial Software
  • Product Updates

fetchOutputs (job)

Retrieve output arguments from all tasks in job

Syntax

data = fetchOutputs(job)

Description

data = fetchOutputs(job) retrieves the output arguments contained in the tasks of a finished job. If the job has M tasks, each row of the M-by-N cell array data contains the output arguments for the corresponding task in the job. Each row has N elements, where N is the greatest number of output arguments from any one task in the job. The N elements of a row are arrays containing the output arguments from that task. If a task has less than N output arguments, the excess arrays in the row for that task are empty. The order of the rows in data is the same as the order of the tasks contained in the job's Tasks property.

Calling fetchOutputs does not remove the output data from the location where it is stored. To remove the output data, use the delete function to remove individual tasks or entire jobs.

fetchOutputs reports an error if the job is not in the 'finished' state, or if one of its tasks encountered an error during execution. If some tasks completed successfully, you can access their output arguments directly from the OutputArguments property of the tasks.

Examples

Create a job to generate a random matrix:

myCluster = parcluster; % Use default profile
j = createJob(myCluster, 'Name', 'myjob');
t = createTask(j, @rand, 1, {10});
submit(j);

Wait for the job to finish and retrieve the random matrix:

wait(j)
data = fetchOutputs(j);
data{1}
Was this topic helpful?