Retrieve output arguments from all tasks in job
data = fetchOutputs(job)
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 arraydata
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 indata
is the same as the order of the tasks contained in the job’sTasks
property.
CallingfetchOutputs
does not remove the output data from the location where it is stored. To remove the output data, use thedelete
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 theOutputArguments
property of the tasks.
创建一个工作来生成一个随机矩阵:
myCluster = parcluster;% Use default profilej = 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}