how to give spesefic name to fopen?
Show older comments
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 Comments
Rik
on 17 Feb 2020
The code in the first block works for me. Are you sure you have writing permission from the OS in that folder?
Jon
on 17 Feb 2020
I can't seem to reproduce your error. It looks like your code creates a valid filename.
MoHa
on 17 Feb 2020
Rik
on 17 Feb 2020
Since we can't reproduce your error, it is difficult to help to solve it.
MoHa
on 17 Feb 2020
Answers (0)
Categories
Find more on Programmatic Model Editing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!