read multiple wav files in matlab

て烟熏妆下的殇ゞ 提交于 2019-12-02 09:35:57

You need to convert the variable t to a string. You were asking to open the file 'path\t.wav', which presumably doesn't exist. Since the variable t is an integer, you can use int2str to convert it to a string:

myFile = ['path\' int2str(t) '.wav'];

Only strings can be concatenated with other strings. Of course if you have fewer than 10 files, then you'll have another problem...

you can use the special print f command: sprintf(); to assign myFile this string.

myFile = sprintf('path\%d.wav',t);

sprintf works in MATLAB just like it does in the C environment.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!