How to select all .wav files from a directory?

14 visualizaciones (últimos 30 días)
Rajith
Rajith el 14 de Ag. de 2014
Editada: Rajith el 14 de Ag. de 2014
Hi,
I have like 125 .wav files in a directory I want to read all of them and perform some function. I have tried a lot but was unsuccessful. I had like this A = {filepathStr='path'}; for i= 1:filelength, [data,fs,nbits] = audioread(A{i});
Can some help me please.
Thanks in advance.

Respuesta aceptada

Ahmet Cecen
Ahmet Cecen el 14 de Ag. de 2014
Editada: Ahmet Cecen el 14 de Ag. de 2014
files = dir('*.wav');
audio = cell(1,125);
for k = 1:125
audio{k} = audioread(files(k).name);
end
  1 comentario
Rajith
Rajith el 14 de Ag. de 2014
path = fullfile('filepath');
files = dir(path);
for fileIndex=1:length(files)
if (files(fileIndex).isdir == 0)
if (~isempty(strfind(files(fileIndex).name,'wav')))
fullfile(path,files(fileIndex).name)
[data,fs] = audioread(fullfile(path,files(fileIndex).name));
/// do some function
end

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Audio I/O and Waveform Generation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by