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 Center および File ExchangeManage Products についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by