Shuffle
From Eigenvector Documentation Wiki
Visited: Shuffle
Contents |
Purpose
Randomly re-order matrix rows.
Synopsis
- xr = shuffle(x)
- [xr,x2r,x3r,x4r...] = shuffle(x,x2,x3,x4...)
- [xr,x2r,x3r,...] = shuffle(x,x2,x3,...,'groups')
Description
This function shuffles samples (rows) in a matrix (e.g. so that they can be used randomly for cross-validations.) If more than one input is provided, all additional inputs (x2, x3, ...) must have same number of rows as x, and will have their rows re-ordered to the same random order as xr.
If the final input is the string groups then the first input is sorted into groups of matching rows and the order of the groups is randomly shuffled, keeping group members together. This is useful for random reordering of measurement replicates. If all the rows of the first input are unique, groups will have no effect on the behavior of shuffle.