| Parallel Computing Toolbox™ | ![]() |
t = createTask(j, F, N, {inputargs})
t = createTask(j, F, N, {C1,...,Cm})
t = createTask(..., 'p1',v1,'p2',v2,...)
t = createTask(...,'configuration',
'ConfigurationName',...)
t | Task object or vector of task objects. |
j | The job that the task object is created in. |
F | A handle to the function that is called when the task is evaluated, or an array of function handles. |
N | The number of output arguments to be returned from execution of the task function. This is a double or array of doubles. |
{inputargs} | A row cell array specifying the input arguments to be passed to the function F. Each element in the cell array will be passed as a separate input argument. If this is a cell array of cell arrays, a task is created for each cell array. |
{C1,...,Cm} | Cell array of cell arrays defining input arguments to each of m tasks. |
p1, p2 | Task object properties configured at object creation. |
v1, v2 | Initial values for corresponding task object properties. |
t = createTask(j, F, N, {inputargs}) creates a new task object in job j, and returns a reference, t, to the added task object. This task evaluates the function specified by a function handle or function name F, with the given input arguments {inputargs}, returning N output arguments.
t = createTask(j, F, N, {C1,...,Cm}) uses a cell array of m cell arrays to create m task objects in job j, and returns a vector, t, of references to the new task objects. Each task evaluates the function specified by a function handle or function name F. The cell array C1 provides the input arguments to the first task, C2 to the second task, and so on, so that there is one task per cell array. Each task returns N output arguments. If F is a cell array, each element of F specifies a function for each task in the vector; it must have m elements. If N is an array of doubles, each element specifies the number of output arguments for each task in the vector. Multidimensional matrices of inputs F, N and {C1,...,Cm} are supported; if a cell array is used for F, or a double array for N, its dimensions must match those of the input arguments cell array of cell arrays. The output t will be a vector with the same number of elements as {C1,...,Cm}.
t = createTask(..., 'p1',v1,'p2',v2,...) adds a task object with the specified property values. For a listing of the valid properties of the created object, see the task object reference page (if using a job manager) or simpletask object reference page (if using a third-party scheduler). If an invalid property name or property value is specified, the object will not be created.
Note that the property value pairs can be in any format supported by the set function, i.e., param-value string pairs, structures, and param-value cell array pairs. If a structure is used, the structure field names are task object property names and the field values specify the property values.
t = createTask(...,'configuration', 'ConfigurationName',...) creates a task job object with the property values specified in the configuration ConfigurationName. For details about defining and applying configurations, see Programming with User Configurations.
Create a job object.
jm = findResource('scheduler','type','jobmanager', ...
'name','MyJobManager','LookupURL','JobMgrHost');
j = createJob(jm);Add a task object which generates a 10-by-10 random matrix.
obj = createTask(j, @rand, 1, {10,10});Run the job.
submit(j);
Get the output from the task evaluation.
taskoutput = get(obj, 'OutputArguments');
Show the 10-by-10 random matrix.
disp(taskoutput{1});Create a job with three tasks, each of which generates a 10-by-10 random matrix.
jm = findResource('scheduler','type','jobmanager', ...
'name','MyJobManager','LookupURL','JobMgrHost');
j = createJob(jm);
t = createTask(j, @rand, 1, {{10,10} {10,10} {10,10}});createJob, createParallelJob, findTask
![]() | createParallelJob | defaultParallelConfig | ![]() |
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |