I cant use audiowrite function in MATAB R2016a
조회 수: 4 (최근 30일)
이전 댓글 표시
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);
댓글 수: 0
답변 (2개)
Stephan
2018년 10월 12일
편집: Stephan
2018년 10월 12일
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
댓글 수: 0
Steven Lord
2018년 10월 12일
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, ...
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!