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 CenterFile Exchange에서 2-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