Main Content

length

Length of parallel object array

    Description

    example

    L = length(obj) returns the length of a parallel object array obj. It is equivalent to the command max(size(obj)).

    Examples

    collapse all

    Examine how many tasks have been assigned to job object, J.

    Create a job and assign a random number of tasks to generate a 10-by-10 random matrix.

    c = parcluster(); % Use default profile
    j = createJob(c);
    num_Tasks = randi([1 50],1);
    for idx = 1:num_Tasks
       task_idx = createTask(j, @rand, 1, {10,10}); 
    end

    Examine the object array of tasks j.Tasks.

    L = length(j.Tasks)
    L = 41
    

    Input Arguments

    collapse all

    Object to examine, specified as a single parallel object or parallel object array. A parallel object can be a distributed, codistributed, gpuArray, Composite, parallel.Job, or parallel.Task object.

    Example: L = length(distributed(1:10))

    Version History

    Introduced before R2006a