Matlab file saving permission denied problem.

I do the following code but when I try to save the 'database' the result is coming out as "Unable to write file database: permission denied."
I can't understand why this happens. please help me.
This is my code:
clear
clc
%store features
for i=1:3
filename=strcat('D:\Project\Matlab files\Youtube code\ku', num2str(i),'.wav');
b = audioread(filename);
%[z, fs(1)]= audioread(filename);
%sound(z, fs(1))
FE=VoiceFeatures(b);
try
load database
F=[F;FE];
FN=[FN;i];
database=[database;F;FN];
save database
catch
F=FE; %Features
FN=i;
save database
end
end
and this is showing in command window:

답변 (1개)

Image Analyst
Image Analyst 2023년 1월 7일

0 개 추천

Look like you might have the file open in MATLAB or in some other program, like the operating system's media player program so it's locked and you can't change it. Make sure it's not open in any other program. Then try putting
fclose('all');
at the beginning of your program. If it's open in MATLAB, this should close it.
Attach database.mat if you still have trouble.

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

질문:

M S
2023년 1월 7일

답변:

2023년 1월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by