cannot create mat file.

1 回表示 (過去 30 日間)
Nor Ashikin
Nor Ashikin 2016 年 5 月 4 日
コメント済み: Nor Ashikin 2016 年 5 月 4 日
>> filename=('s2.wav');
>> y=wavread(filename);
>> [y,Fs,nbits]=wavread(filename);
>> save(filename,'-mat');
why save(filename,'-mat'); does not create the *.mat file?

採用された回答

CS Researcher
CS Researcher 2016 年 5 月 4 日
You should do this:
filename = 's2.wav';
[y, Fs] = audioread(filename);
save('s2.mat','y');
  4 件のコメント
Walter Roberson
Walter Roberson 2016 年 5 月 4 日
mat files do not appear in workspaces. Variables appear in workspaces. But not if you are using a static workspace
Nor Ashikin
Nor Ashikin 2016 年 5 月 4 日
Thanks for your help CS Researcher and Walter Roberson as well. It worked actually. Just my mistake.

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

その他の回答 (2 件)

Walter Roberson
Walter Roberson 2016 年 5 月 4 日
save() is not defined to override your choice of file extensions. If a file already has an extension, then save() will use that extension. So what you are doing is overwriting your .wav file with the mat contents.
If you want to change the extension, then use fileparts to extract the file name without the extension; when there is no extension, .mat will be added.

MHN
MHN 2016 年 5 月 4 日
Just use
save 'filename'
  1 件のコメント
Walter Roberson
Walter Roberson 2016 年 5 月 4 日
That would create 'filename.mat' -- literally "filename", not 's2.mat'

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

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by