I'm looking for an efficient way to manipulate a 40x151 matrix so that the rows are randomly scrambled.
Asked
Active
Viewed 618 times
0
-
Well done @tashuhka for spotting the duplicate! – Luis Mendo Oct 28 '15 at 10:35
1 Answers
4
I worked out the answer just as I was about to post.
new_matrix = old_matrix(randperm(40),:)

user1205901 - Слава Україні
- 927
- 1
- 12
- 26
-
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