MATLAB: How do i select random indicies from an array

array

I have an array of 10 by 6. is there a way I can randomly select rows from this particular array and everything within it.

Best Answer

Let's say you have a 10-by-6 matrix m, and you want to select 7 rows at random and make sure there are no repeats. Do this:
m = randi(9, 10,6)
randomRows = randperm(size(m, 1), 7)
randomRows is the array of row numbers , not the actual 6 element rows themselves.