How to pick randomly elements from a vector without repetation?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
IBM watson
am 22 Okt. 2018
Bearbeitet: Bruno Luong
am 22 Okt. 2018
If I have a vector like this :
a=[1 2 3 4 5]
i know how to do this but my vector is something like:
a=[23 46 4 2 5]
I should pick 2 elements randomly without repetation.
0 Kommentare
Akzeptierte Antwort
Bruno Luong
am 22 Okt. 2018
Bearbeitet: Bruno Luong
am 22 Okt. 2018
a(randperm(length(a),2))
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots 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!