generation of permuted matrix

1 Ansicht (letzte 30 Tage)
Rica
Rica am 6 Dez. 2012
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 Kommentare
Andrei Bobrov
Andrei Bobrov am 6 Dez. 2012
Bearbeitet: Andrei Bobrov am 6 Dez. 2012
See ADD in my answer.
Jos (10584)
Jos (10584) am 6 Dez. 2012
What is the function permuted doing to A?
What should B look like exactly, given A = [2 3 6 5]?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 6 Dez. 2012
A=1:120; %your data
for k=1:10
[idx,idx]=sort(rand(1,120))
out(k,:)=A(idx)
end
  1 Kommentar
Matt Fig
Matt Fig am 6 Dez. 2012
[idx,idx] = sort(rand(1,n));
or
idx = randperm(n);
But, for this case:
[idx,idx] = sort(rand(10,120),2);
out = A(idx);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by