User`s guide

createTask
11-59
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}. Note that
because a communicating job has only one task, this form of vectorized task creation is
not appropriate for such jobs.
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
parallel.Task object reference page. The property name must be in the form of a
string, with the value being the appropriate type for that property. The values specified
in these property-value pairs override the values in the profile. If an invalid property
name or property value is specified, the object will not be created.
t = createTask(...,'Profile', 'ProfileName',...) creates a task object
with the property values specified in the cluster profile ProfileName. For details about
defining and applying cluster profiles, see “Clusters and Cluster Profiles” on page 6-14.
Examples
Create a Job with One Task
Create a job object.
c = parcluster(); % Use default profile
j = createJob(c);
Add a task object which generates a 10-by-10 random matrix.
t = createTask(j, @rand, 1, {10,10});