![](/img/trans.png)
[英]How can I transfer information from one sheet in Excel to another using VBA based on specific conditions?
[英]How do I read all the .wav audio file in one folder using information from an excel sheet in Matlab?
嗨,我有一个关于 Matlab 编程的问题,我想问一下我是否使用的是 Mac OS,并且我已将所有音频文件放在与 Matlab 相同的文件夹中,如何读取所有.wav
音频文件? 我想自动化这个过程。
例子:
首先,我有一张带有音频文件名和信息的 excel 表。
其次,我想从 excel 表(第一列)中提取音频文件名,并将其放入audioread
中的 audioread function 中。
我需要使用以下音频阅读audioread
。
[y,Fs]=audioread('audio1.wav');
我想阅读audio1.wav
并对其进行一些计算。 完成计算后,我将继续阅读audio2.wav
并对其进行相同的计算。 你能教我怎么做并给我看代码吗?
谢谢你。
在 Matlab 中,您可以使用readmatrix
读取 xls 文件。 您最好先将音频文件的电子表格导出到csv 文件。
关于组织数据,电子表格最容易包含文件的完整路径名(即/path/from/root/to/file.wav
)
因此,假设您有一个audio_files.csv
文件路径,例如
/path/to/file1.wav, file1data
/path/to/file2.wav, file2data
/path/to/file3.wav, file3data
您可以使用类似的内容读取每个文件
filename = 'audio_files.csv';
audio_file_list = readmatrix(filename);
for audio_file = audio_file_list(:,1) % so long as the first column is the file paths
[y,Fs]=audioread(audio_file);
% do something to y
end
当然, % do something to y
将完全取决于您想要实现的目标。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.