Main Content

getLocalPart

Local portion of codistributed array

Syntax

L = getLocalPart(A)

Description

L = getLocalPart(A) returns the local portion of a codistributed array.

Examples

Create an array and then distributed the array across all workers. Get the local part on each worker.

parpool("Processes",4);
spmd
    A = magic(4);   % replicated on all workers
    D = codistributed(A, codistributor1d(1));
    L = getLocalPart(D)
end
Worker 1: 
  
  L =
  
      16     2     3    13
  
Worker 2: 
  
  L =
  
       5    11    10     8
  
Worker 3: 
  
  L =
  
       9     7     6    12
  
Worker 4: 
  
  L =
  
       4    14    15     1
  

Version History

Introduced in R2009b