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

1 visualizzazione (ultimi 30 giorni)
i have a vector which contain 23 elements.i wanna choose 20 elements among this 23 elements randomly.how can i do this?

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 19 Apr 2016
Modificato: Azzi Abdelmalek il 19 Apr 2016
A=randi(50,1,23)
out = A(randperm(23,20))
  3 Commenti

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by