How to pick randomly elements from a vector without repetation?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
IBM watson
le 22 Oct 2018
Modifié(e) : Bruno Luong
le 22 Oct 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 commentaires
Réponse acceptée
Bruno Luong
le 22 Oct 2018
Modifié(e) : Bruno Luong
le 22 Oct 2018
a(randperm(length(a),2))
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots 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!