cannot create mat file.
3 views (last 30 days)
Show older comments
Commented: Nor Ashikin on 4 May 2016
why save(filename,'-mat'); does not create the *.mat file?
CS Researcher on 4 May 2016
You should do this:
filename = 's2.wav';
[y, Fs] = audioread(filename);
More Answers (2)
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 on 4 May 2016
That would create 'filename.mat' -- literally "filename", not 's2.mat'
Find more on Workspace Variables and MAT-Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!