how to give spesefic name to fopen?

조회 수: 1 (최근 30일)
MoHa
MoHa 2020년 2월 17일
댓글: MoHa 2020년 2월 17일
Hi everybody,
i want to to write a file with specific and every time (in for loop) different name?
For Example: i tried as following:
prjName='HafencityLabor';
ScanName='GComScan_20200217_124239';
ScanVolume='83964';
ScanFullName=strcat(ScanName, '_', ScanVolume, '_', prjName)
ScanF=fopen([ScanFullName '.sdb'],'a+');
than i want to move the file into other subfolder as following:
outputFolder = fullfile(pwd, 'SDBsFiles');
if ~exist(outputFolder, 'dir')
mkdir(outputFolder);
end
movefile([ScanFullName '.sdb'], 'SDBsFiles');
but i get this Error:
Error using fopen
First input must be a file name or a file identifier.
Thanks for your Helps!
  댓글 수: 5
Rik
Rik 2020년 2월 17일
Since we can't reproduce your error, it is difficult to help to solve it.
MoHa
MoHa 2020년 2월 17일
Thank you guys for your Answer. i dont know what's the Problem. i solved it as folowing:
ScanF=fopen('scanname.sdb','a+');
newName=char(strcat(ScanFullName, '.sdb'));
movefile('scanname.sdb', newName)
movefile(newName, 'SDBsFiles');
it's not so cool but it works for me. ;)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Manage Products에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by