Effacer les filtres
Effacer les filtres

Hi,Is there anyone who could give an idea how to create a permutation vector?

1 vue (au cours des 30 derniers jours)
Like,every time the loop constructs,the vector would change.
For example V1=[1 2 3 5 4]; V2=[2 3 1 5 4] and go on?

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 6 Juin 2016
V1=[1 2 3 5 4]
n=numel(V1)
idx=randperm(n)
V2=V1(idx)
  1 commentaire
nafila aytija
nafila aytija le 6 Juin 2016
what if I want to create four vector from four four different permuations?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by