How to pick randomly elements from a vector without repetation?

2 ビュー (過去 30 日間)
IBM watson
IBM watson 2018 年 10 月 22 日
編集済み: Bruno Luong 2018 年 10 月 22 日
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 Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by