MATLAB Answers

Randomized Groups of Array

1 view (last 30 days)
Zoe Brown
Zoe Brown on 20 Oct 2020
Answered: Matt J on 20 Oct 2020
If I have an array of doubles, how would I place those numbers into randomized groups? Ex. I have 250 numbers and I want them in 50 groups of 5 or 25 groups of 10, but all randomized.

  0 Comments

Sign in to comment.

Answers (1)

Matt J
Matt J on 20 Oct 2020
Ex. I have 250 numbers and I want them in 50 groups of 5
reshape( randperm(250) , 5,50)
or 25 groups of 10,
reshape( randperm(250) , 10,25)

  0 Comments

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!