Shuffle
Jump to navigation
Jump to search
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
SHUFFLE randomly re-orders the rows of the input matrix x and returns the results as xr.
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.