User`s guide

ones
11-209
Examples
Create Distributed Ones Matrix
Create a 1000-by-1000 distributed array of ones with underlying class double:
D = ones(1000,'distributed');
Create Codistributed Ones Matrix
Create a 1000-by-1000 codistributed double matrix of ones, distributed by its second
dimension (columns).
spmd(4)
C = ones(1000,'codistributed');
end
With four workers, each worker contains a 1000-by-250 local piece of C.
Create a 1000-by-1000 codistributed uint16 matrix of ones, distributed by its columns.
spmd(4)
codist = codistributor('1d',2,100*[1:numlabs]);
C = ones(1000,1000,'uint16',codist);
end
Each worker contains a 100-by-labindex local piece of C.
Create gpuArray Ones Matrix
Create a 1000-by-1000 gpuArray of ones with underlying class uint32:
G = ones(1000,'uint32','gpuArray');
See Also
eye | false | Inf | NaN | ones | true | zeros