Dataset shuffle
Dataset_shuffle
Purpose
Returns the given Dataset object shuffled in a specified dimension.
Synopsis
- dsoOut = shuffle(dsoIn,vDim,inVect);
- [dsoOut,randVect,undoVect] = shuffle(dsoIn,vDim,inVect);
Description
Shuffle the Dataset object with the shuffle command. This method returns the DataSet Object with the desired entry in the specified dimension (rows, columns, etc.) randomize. The order of the shuffle is stored in the second input argument (randVect) can be used to shuffle another DataSet object in the exact same other. The third input argument (undoVect) can be used to undo the shuffle of the DataSet object.
Examples
To repeat a shuffle to a new DataSet object, use the previous randVect as the third input argument when shuffling a new DataSet:
- data = shuffle(newData,1,randVect);
To undo a shuffle to a dataset, input the dataset along with the undoVect with the corresponding dimension:
- unshuffledData = shuffle(data,1,undoVect);
Alternatively, shuffle can also be used to sort a dataset to a specific order using a vector containing the ordered indexes:
- reorderedData = shuffle(data,1,newOrderVect);