Shuffle: Difference between revisions
Jump to navigation
Jump to search
imported>Jeremy (Importing text file) |
imported>Jeremy (Importing text file) |
||
Line 7: | Line 7: | ||
:xr = shuffle(x) | :xr = shuffle(x) | ||
:[xr,x2r,x3r,x4r...] = shuffle(x,''x2,x3,x4...'') | :[xr,x2r,x3r,x4r...] = shuffle(x,''x2,x3,x4...'') | ||
:[xr,x2r,x3r,...] = shuffle(x,x2,x3,...,'groups') | :[xr,x2r,x3r,...] = shuffle(x,x2,x3,...,'groups') | ||
Revision as of 16:35, 3 September 2008
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.