I want to create cell arrays containing all zero elements in them.

116 views (last 30 days)
Dear all,
I am dealing with some stress transformation. I want to create a cell array C = cell (1,20). In each cell array, I want to fill C{1,1}=zeros (2600,6), C{1,2}=zeros (2600,6), and son. I can do this in a traditional way one by one, but I am here to see a simpler way. I want this because I will use a cell array of all zero elements in a loop.

Accepted Answer

Voss
Voss on 15 Jun 2022
C = repmat({zeros(2600,6)},1,20)
C = 1×20 cell array
{2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double} {2600×6 double}

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!