フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Can I analyse more than one audio file in one code?

1 回表示 (過去 30 日間)
Mike
Mike 2015 年 2 月 5 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have analysed one audio file, which is 1hour of recording, made a spectrogram and everything I wanted to do. I have 60 more files which are the following 60hours of recording which need analysing in the same graphs.
Is it possible to continuously loop through all of the files?
Here is the code:
[slab,S_R,bits] = wavread('E:\1.wav',[1 2]);
  1 件のコメント
Stalin Samuel
Stalin Samuel 2015 年 2 月 5 日
yes ...you can analyse more than one audio file in one code

回答 (1 件)

Stalin Samuel
Stalin Samuel 2015 年 2 月 5 日
dirName = 'your file directory'
dirData = dir(dirName); %# Get the data for the current directory
dirIndex = [dirData.isdir]; %# Find the index for directories
fileList = {dirData(~dirIndex).name}'; %'# Get a list of the files
if ~isempty(fileList)
fileList = cellfun(@(x) fullfile(dirName,x),... %# Prepend path to files
fileList,'UniformOutput',false);
end
subDirs = {dirData(dirIndex).name}; %# Get a list of the subdirectories
validIndex = ~ismember(subDirs,{'.','..'}); %# Find index of subdirectories
x = 0 %# that are not '.' or '..'
for iDir = find(validIndex)
%# Loop over valid subdirectories
x=x+1
nextDir = fullfile(dirName,subDirs{iDir}); %# Get the subdirectory path
fileList = [fileList; getAllFiles(nextDir)]; %# Recursively call getAllFiles
% pause(1)
end
nfil=size(fileList)
for m = 1:nfil
[y1, Fs1] = wavread(sprintf('%s',fileList{m,1}));
%%your code
end

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by