read multiple .pcm files from a directory
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
hey guys,i need some help here,well i have a main folder and there's inside him 2 subfolders each of it has 60 .pcm files..i have to open and read them using this code:
fid=fopen('filename.pcm','r');
sig=fread(fid,inf,'int16');
fclose(fid);
i use this command x=dir('mydirectory\*.pcm') and then i write
for i=1:length(x)
y=x(i).name
end
the problem is when after this for loop write the command
fid=fopen('y','r')
matlab doesn't accept y as for my filename!any ideas???
thx in advance
0 commentaires
Réponse acceptée
Walter Roberson
le 6 Fév 2012
You should be doing your processing of the file within your "for" loop: otherwise, each time through the loop, you over-write "y" with the latest x(i).name
Your open should be:
thisfile = ['mydirectory\' y];
fid = fopen(thisfile, 'r')
This is needed in order to account for the directory, and is also needed so that you do not try to open the file whose name is literally "y"
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur PCM dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!