Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
i have a vector which contain 23 elements.i wanna choose 20 elements among this 23 elements randomly.how can i do this?

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 19 Apr. 2016
Bearbeitet: Azzi Abdelmalek am 19 Apr. 2016
A=randi(50,1,23)
out = A(randperm(23,20))
  3 Kommentare

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Resizing and Reshaping 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