MATLAB: Random selection

randomrow

I have a matrix size of 96×249.How can i select 48 rows randomly and store it into a new matrix of 48×249.I have values in matrix as decimal numbers.

Best Answer

T = randperm(96);
NewMatrix = OldMatrix(T(1:48),:);