i have a vector which contain 23 elements.i wanna choose 20 elements among this 23 elements randomly.how can i do this?

1 view (last 30 days)
i have a vector which contain 23 elements.i wanna choose 20 elements among this 23 elements randomly.how can i do this?

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 19 Apr 2016
Edited: Azzi Abdelmalek on 19 Apr 2016
A=randi(50,1,23)
out = A(randperm(23,20))
  3 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!