How to convert multiple .mat into .wav ?

1 回表示 (過去 30 日間)
Hamzah amee
Hamzah amee 2014 年 4 月 2 日
コメント済み: Hamzah amee 2014 年 4 月 3 日
Hi I have (.mat) file containing 19 cropped data as shown in the figure. How can I convert it to (.wav) ?I dont want to convert it one by one.I got this code from a friend, but the (.wav) are empty. Also, the .wav produced are not the same count as the original cropped(I cropped 19 it gave me 25 (.wav)). If the sampling frequency is the issue, I followed the Fs of the original .wav(before I cropped). The code is:
fs = 44100 %change to your sample rate
load('result.mat');
data = whos;
for i = 1:length(data)
wavwrite(data(i).name,fs,num2str(i));
end
Thanks a lot, Hope somebody will help.

回答 (1 件)

Walter Roberson
Walter Roberson 2014 年 4 月 2 日
W = load('result.mat');
fn = fieldnames(W);
for i = 1 : length(fn)
wavwrite( W.fn{K}, fs, num2str(i));
end
  1 件のコメント
Hamzah amee
Hamzah amee 2014 年 4 月 3 日
Hi @Walter Roberson, Thanks..however I got this error: Undefined function or variable 'K'.
Error in convert_to_wav (line 4) wavwrite( W.fn{K}, fs, num2str(i));
Tq

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by