How to pick randomly elements from a vector without repetation?

1 次查看(过去 30 天)
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.

采纳的回答

Bruno Luong
Bruno Luong 2018-10-22
编辑:Bruno Luong 2018-10-22
a(randperm(length(a),2))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 WLAN Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by