Is there any way of creating a 3D matrix randomly? There are ways to create random 2D matrices using randint function. Is there any inbuilt function like that?
E.g.
If you read the help carefully, you will notice that the randi function accepts any number of dimensions. You may do randi(10,3,3,3)
randi(10,3,3,3)
randi(10,3,3,3) ans(:,:,1) = 9 10 3 10 7 6 2 1 10 ans(:,:,2) = 10 10 2 2 5 5 10 9 10 ans(:,:,3) = 8 1 7 10 9 8 7 10 8