I cant use audiowrite function in MATAB R2016a

5 vues (au cours des 30 derniers jours)
NEEMA RAJ
NEEMA RAJ le 12 Oct 2018
if true
% code
end
clc;
clear all;
close all;
[wavdata,fs] = audioread('roja.wav');
wavbinary = dec2bin( typecast( single(wavdata(:)), 'uint8'), 8 ) - '0';
orig_size = size(wavdata);
data_class_to_use = 'int32'; %or as appropriate
SampleRate = fs; %set as appropriate
wavdata1 = reshape( typecast( uint8(bin2dec( char(wavbinary + '0') )), data_class_to_use ), orig_size );
audiowrite('ABC_REC.wav', wavdata1, SampleRate);
clear wavdata1 fs;
[wavdata1,fs] = audioread('ABC_REC.wav');
sound(wavdata1,fs);
Following error message shows Error using audiowrite>validateFilename (line 323) Cannot create file ABC_REC.wav. Permission Denied.
Error in audiowrite (line 105) [props.filename, fileExisted] = validateFilename( props.filename );
Error in san_lgc (line 10) audiowrite('ABC_REC.wav', wavdata1, SampleRate);

Réponses (2)

Stephan
Stephan le 12 Oct 2018
Modifié(e) : Stephan le 12 Oct 2018
Hi,
this appears to be not a problem of Matlab. Try:
audiowrite('C:\Path_you_are_allowed_to_write_in\ABC_REC.wav', wavdata1, SampleRate);
A (bad) workaround could be, to run Matlab as administrator.
A further reason for this error could be, the file is already opened in another software.
Best regards
Stephan

Steven Lord
Steven Lord le 12 Oct 2018
Do you have write permissions for your current directory when you try to execute that command?
One way to test this is to try writing the file into your temporary directory, for which you ought to have write permission. [If you don't, I'd expect lots of other functionality to fail.]
filenameInTemp = fullfile(tempdir, 'ABC_REC.wav');
audiowrite(filenameInTemp, ...

Catégories

En savoir plus sur Code Execution dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by