How to subset rows with reproducibility?

If I have a 10 by 5 matrix, how would I subset the data so that the same rows are selected each time?
I know how to select 10 random rows, but I'm unsure how to make it reproducible.

 Accepted Answer

If you’re using a random number generator to select the rows, see the documentation for the rng (link) function. Otherwise, just select them yourself, for example [3 9 5 2 7], or whatever combination you want.

More Answers (0)

Tags

Asked:

on 20 Feb 2018

Answered:

on 20 Feb 2018

Community Treasure Hunt

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

Start Hunting!