Documentation
Shuffle files in datastore
shuffledADS = shuffle(ADS)
shuffledADS = shuffle(ADS) creates a deep copy of the input datastore, ADS, and shuffles the files using randperm.
shuffledADS
ADS
randperm
collapse all
Create an audioDatastore object ADS. Shuffle the files to create a new datastore containing the same files in random order.
audioDatastore
ADS = audioDatastore(fullfile(matlabroot,'toolbox','audio','samples'))
ADS = audioDatastore with properties: Files: { ' .../build/matlab/toolbox/audio/samples/Ambiance-16-44p1-mono-12secs.wav'; ' .../matlab/toolbox/audio/samples/AudioArray-16-16-4channels-20secs.wav'; ' .../toolbox/audio/samples/ChurchImpulseResponse-16-44p1-mono-5secs.wav' ... and 26 more } AlternateFileSystemRoots: {} OutputDataType: 'double' Labels: {}
ADSshuffled = shuffle(ADS)
ADSshuffled = audioDatastore with properties: Files: { ' .../build/matlab/toolbox/audio/samples/SoftGuitar-44p1_mono-10mins.ogg'; ' .../build/matlab/toolbox/audio/samples/Engine-16-44p1-stereo-20sec.wav'; ' .../toolbox/audio/samples/ChurchImpulseResponse-16-44p1-mono-5secs.wav' ... and 26 more } AlternateFileSystemRoots: {} OutputDataType: 'double' Labels: {}
Input audio datastore, specified as an audioDatastore object.
Shuffled audio datastore, returned as an audioDatastore object containing randomly ordered files from ADS.
A modified version of this example exists on your system. Do you want to open this version instead?
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office
Get trial now