MATLAB: Generating n random matrices

generation of random matrices

Hi to all , I want to generate matrices with the following code.
nmc = 1000
matrices(1:nmc) = rand(3,3,nmc)
I want to generate 1000 random matrices of 3×3.
Regards

Best Answer

How about
nmc = 1000
matrices = rand(3,3, nmc);
To get any one particular 3x3 matrix, just extract it out of the 3D array by specifying the plane. For example to get the 10th matrix:
one3x3 = matrices(:,:, 10);