How do I copy some files to another folder?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jacopo Scarpellini
am 11 Aug. 2022
Bearbeitet: Stephen23
am 11 Aug. 2022
I have a 10x1 string array which represents a list of files that I want to copy to a different folder
file_list =
10x1 string array
for j = 1:size(file_list,1)
copyfile file_list{j,:} destination_folder
end
I get the error
Error using copyfile
No matching files were found.
I guess the filename cannot be a string, but then what does it need to be?
0 Kommentare
Akzeptierte Antwort
Voss
am 11 Aug. 2022
for j = 1:size(file_list,1)
copyfile(file_list(j),destination_folder)
end
0 Kommentare
Weitere Antworten (1)
Stephen23
am 11 Aug. 2022
Bearbeitet: Stephen23
am 11 Aug. 2022
"I guess the filename cannot be a string..."
The filenames certainly can be string.
The problem is the you are using command syntax when you should be using function syntax:
copyfile(file_list(j),destination_folder)
% ^ ^ function syntax
0 Kommentare
Siehe auch
Kategorien
Mehr zu String Parsing 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!