Search code examples
matlabimport-from-excel

How to shuffle (completely at random) big data stored in Excel file by Matlab?


I want to shuffle my data row wise (in a single unique row there will be no shuffling, it has to remain the same - I mean all individual cells in a single row can not change). The number of rows I have in my excel files is around 170000.

All I need is to shuffle randomly all the rows among them. How can I do this by mat-lab commands? Codes or algorithm please!

enter image description here


Solution

  • For reading and writing excel files see xlsread and xlswrite.

    To randomly shuffle the rows of a matrix:

    M = magic(5);
    Mshuffled = M(randperm(size(M, 1)), :)