I can't copy the files, received unknown error

12 Ansichten (letzte 30 Tage)
mehtap agirsoy
mehtap agirsoy am 25 Jun. 2021
Kommentiert: mehtap agirsoy am 25 Jun. 2021
I am trying to copy files to a new folder but I have received unknown error. I used similar code before and copyfile command worked well but this time it doesn't. I couldn't figure it out. Could you please help? Thanks in advance
  2 Kommentare
Jan
Jan am 25 Jun. 2021
Bearbeitet: Jan am 25 Jun. 2021
Please post the complete error message. You do have this important information. Then it is useful to share it with the readers.
There is no fopen() in your code. Why do you close all files brutally by fclose all?
mehtap agirsoy
mehtap agirsoy am 25 Jun. 2021
While reading the forums I saw such a suggestion to use fclose all, so tried it. Thanks, I should be careful.
Error using copyfile
Unknown error occurred.
Error in all_tests (line 57)
copyfile (filename ,fold2);

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 25 Jun. 2021
% Mean Velocity
filename = sprintf('M1_Normal_T%d_%s_M_Vel.dat',j,word);
allFileInfo = fullfile(start_path,filename);
filename refers to a file that lives under start_path but the filename variable does not include that path information.
copyfile (filename ,fold2);
but there it is being referred to as if it is in the current directory.
  3 Kommentare
Walter Roberson
Walter Roberson am 25 Jun. 2021
You have
filename = sprintf('M1_Normal_T%d_%s_M_Vel.dat',j,word);
allFileInfo = fullfile(start_path,filename);
so allFileInfo is already the qualified version of the file name. copyfile(allFileInfo, fold2)
mehtap agirsoy
mehtap agirsoy am 25 Jun. 2021
It works. Many thanks for the help.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Import and Analysis finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by