How to read datastore from specified position?

8 次查看(过去 30 天)
In official documents,they have not introuduce how to read datastore from specified position?
For example,I build a audiodatastore with 400 sound files.When I read it,it only begins from the first or last time position.
I want to read from 20 to 40, I use follow code:
adsTest = audioDatastore(fullfile(dataFolder,'test'),'IncludeSubfolders',true);
[cleanAudio,adsTestInfo] = read(adsTest(20:40));
it does not work.It says "Array formation and parentheses-style indexing with objects of class 'audioDatastore' is not allowed. Use objects of class 'audioDatastore' only as scalars or use a cell array."

回答(1 个)

jibrahim
jibrahim 2021-9-7
编辑:jibrahim 2021-9-9
Hi Neal,
Here is one way to read files from a custom position:
adsSub = subset(adsTest,20:40);
allSignals = readall(adsSub); % or call read on adsSub to get one signal at a time

类别

Help CenterFile Exchange 中查找有关 AI for Signals 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by