Azzera filtri
Azzera filtri

Shuffling a vector for n times to generate a new vector

2 visualizzazioni (ultimi 30 giorni)
A is a vector. I want to shuffle its elements for n times to generate a new vector. For example:
A = [3 5 1];
out = [Shuffle(A) Shuffle(A) Shuffle(A)] % n = 3, but may be a large value
out =
1 5 3 5 1 3 5 3 1
For a large value of n, I can do it using a loop. But, I was wondering if there was any easy without looping. Thanks.

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 22 Lug 2015
A = [3 5 1]

Più risposte (0)


Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by