generating n random matrices

조회 수: 3 (최근 30일)
Offroad Jeep
Offroad Jeep 2015년 9월 12일
댓글: Steven Lord 2016년 5월 17일
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 3x3.
Regards

채택된 답변

Image Analyst
Image Analyst 2015년 9월 12일
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);
  댓글 수: 2
Offroad Jeep
Offroad Jeep 2016년 5월 17일
Not working
Steven Lord
Steven Lord 2016년 5월 17일
Works fine for me. Can you elaborate a little bit on what "not working" means -- does it throw an error (and if so, what is the FULL, EXACT text of that error), does it issue a warning (again, FULL EXACT text), does it not satisfy some other requirement you have, etc.?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by