cannot create mat file.

조회 수: 8 (최근 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 CenterFile Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by