Generation of Random matrices in ascending order

1 回表示 (過去 30 日間)
Offroad Jeep
Offroad Jeep 2016 年 10 月 22 日
コメント済み: Offroad Jeep 2016 年 10 月 23 日
Hi to all the matlab users. I want to generate 5 matrices of 3X3. the initial matrix is having all zeros. then the next 5 matrices that are generated should have random elements between 0 to pi but in ascending order at their respective loctions. e.g i am giving example 1st element of 1st matrix 0 1st element of 2nd matrix 0.0034 1st element of 3rd matrix 0.0139 1st element of 4th matrix 0.9861 1st element of 5th matrix 1.2345 1st element of 6th matrix 2.8904
similarly for other element.... Note: the element at same location of matrices are ascending. I hope I am able to clarify the question.
Regards.....

採用された回答

Image Analyst
Image Analyst 2016 年 10 月 22 日
This will do it:
% Get all 5 matrices in one 3D array in sorted order.
m3d = sort(pi * rand(3,3,5), 3)
% Extract out 5 separate, individual matrices.
matrix1 = m3d(:, :, 1)
matrix2 = m3d(:, :, 2)
matrix3 = m3d(:, :, 3)
matrix4 = m3d(:, :, 4)
matrix5 = m3d(:, :, 5)
  1 件のコメント
Offroad Jeep
Offroad Jeep 2016 年 10 月 23 日
Thanks for your answer.....

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by