0

I'm looking for an efficient way to manipulate a 40x151 matrix so that the rows are randomly scrambled.

1 Answers1

4

I worked out the answer just as I was about to post.

new_matrix = old_matrix(randperm(40),:)
  • 1
    +1 for thinking of `randperm` and not `randi`. The latter can sometimes give repeated values, which will cause your matrix rows to be repeated while shuffling. – Autonomous Oct 28 '15 at 08:45