cell array contain zeros matrix

7 views (last 30 days)
How to create cell array size 1X100 which contain zeros matrix size 366X28 in each cell

Accepted Answer

Harish Ramachandran
Harish Ramachandran on 20 Dec 2017
for i=1:100
a{i} = zeros(366,28);
end
Loop through each cell array block and insert a zeros matrix inside.
  3 Comments
SM
SM on 11 Feb 2020
Is it posible to solve the problem without using loop?
Michal Dudek
Michal Dudek on 27 Feb 2020
Yes, it is possible. Use this code:
a = mat2cell(repmat(zeros(366,28),1,100),366,repmat(28,1,100));

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!