cannot create mat file.

9 vues (au cours des 30 derniers jours)
Nor Ashikin
Nor Ashikin le 4 Mai 2016
Commenté : Nor Ashikin le 4 Mai 2016
>> filename=('s2.wav');
>> y=wavread(filename);
>> [y,Fs,nbits]=wavread(filename);
>> save(filename,'-mat');
why save(filename,'-mat'); does not create the *.mat file?

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (2)

Walter Roberson
Walter Roberson le 4 Mai 2016
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 le 4 Mai 2016
Just use
save 'filename'
  1 commentaire
Walter Roberson
Walter Roberson le 4 Mai 2016
That would create 'filename.mat' -- literally "filename", not 's2.mat'

Connectez-vous pour commenter.

Catégories

En savoir plus sur Workspace Variables and MAT Files dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by