How to make a 3D Matrix
Show older comments
How to make a 3D Matrix that contains all ones in the first layer, all twos in the second layer and all threes in the third layer?
5 Comments
Fangjun Jiang
on 3 Sep 2020
define layer
David Hill
on 3 Sep 2020
Do you mean something like:
f(1:5,1:5,1)=1;
f(1:5,1:5,2)=2;
f(1:5,1:5,3)=3;
Nicholas Deosaran
on 3 Sep 2020
Abdolkarim Mohammadi
on 3 Sep 2020
Size = [5,6,3];
M = ones(Size) .* permute([1;2;3],[3,2,1]);
Nicholas Deosaran
on 3 Sep 2020
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices 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!