i have a vector which contain 23 elements.i wanna choose 20 elements among this 23 elements randomly.how can i do this?

2 vues (au cours des 30 derniers jours)
i have a vector which contain 23 elements.i wanna choose 20 elements among this 23 elements randomly.how can i do this?

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 19 Avr 2016
Modifié(e) : Azzi Abdelmalek le 19 Avr 2016
A=randi(50,1,23)
out = A(randperm(23,20))
  3 commentaires

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB 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