Create a random Matrix
이전 댓글 표시
I have a 8 column vector n*1. Can I create a Random matrix of n*8?
The function must take one value from each vector and create a matrix with 8 columns and n rows.
Please help me :-)
채택된 답변
추가 답변 (1개)
Walter Roberson
2011년 10월 24일
rv(:,1) = randomvector1;
rv(:,2) = randomvector2;
rv(:,3) = randomvector3;
....
rv(:,4) = randomvector4;
rants = zeros(8, n);
for K = 1:n
rants(:,K) = A Random Selection of One Entry Per Column from rv
end
How to do "A Random Selection of One Entry Per Column from rv" is left to you to work on in more detail. I will hint that it involves using rand().
댓글 수: 3
Maurizio
2011년 10월 30일
Maurizio
2011년 10월 30일
Walter Roberson
2011년 10월 30일
floor(1 + n * rand())
will give you a random row number.
If I say much more than I will be completing your assignment for you.
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!