generation of permuted matrix

조회 수: 2 (최근 30일)
Rica
Rica 2012년 12월 6일
Hi!
I have a vector A=[2 3 6 5].
how could i generate a matrix from this arraý in this manner?
%
B=[A permuted(A) permuted(A).....]
Thank you
[edit]
May array has the length of 120! in matlab help i read that perms makes sense just for length less than 11. and am looking for B with size of (120*10).
  댓글 수: 2
Andrei Bobrov
Andrei Bobrov 2012년 12월 6일
편집: Andrei Bobrov 2012년 12월 6일
See ADD in my answer.
Jos (10584)
Jos (10584) 2012년 12월 6일
What is the function permuted doing to A?
What should B look like exactly, given A = [2 3 6 5]?

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

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 12월 6일
A=1:120; %your data
for k=1:10
[idx,idx]=sort(rand(1,120))
out(k,:)=A(idx)
end
  댓글 수: 1
Matt Fig
Matt Fig 2012년 12월 6일
[idx,idx] = sort(rand(1,n));
or
idx = randperm(n);
But, for this case:
[idx,idx] = sort(rand(10,120),2);
out = A(idx);

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

추가 답변 (0개)

카테고리

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