i have a vector which contain 23 elements.i wanna choose 20 elements among this 23 elements randomly.how can i do this?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
fariba amini
am 19 Apr. 2016
Kommentiert: fariba amini
am 19 Apr. 2016
i have a vector which contain 23 elements.i wanna choose 20 elements among this 23 elements randomly.how can i do this?
0 Kommentare
Akzeptierte Antwort
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
Azzi Abdelmalek
am 19 Apr. 2016
Bearbeitet: Azzi Abdelmalek
am 19 Apr. 2016
out = A(sort(randperm(23,20)))
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!