フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

creating new file using data base

2 ビュー (過去 30 日間)
Dilawar Khan
Dilawar Khan 2017 年 5 月 7 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
this is my project
function[w]=check()
w=0;
q= input('Enter the name of file ','s');
switch(q)
case('dk')
if (exist('dk.wav') == 2)
disp('File is presesnt ');
w=w+1;
end
otherwise
disp('File is not presesnt ');
end
i just want that user will give name if that name is not present then it will create a new .wav file and come in case so that i can check like case ('dk') if new file has been created then that will automatically or by some way come in case (---) kindly guide me i shall be thank full to you

回答 (1 件)

KSSV
KSSV 2017 年 5 月 8 日
filename = input('Enter the name of file with extension: ','s');
if exist(filename,'file')
fprintf('%s file exists\n',filename)
else
fprintf('%s file doesnot exist and I am creating\n',filename)
data = rand(10,1) ; % some data to write into file
save(filename,'data','-ascii')
end

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by