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?

 채택된 답변

Voss
Voss 2022년 8월 11일

0 개 추천

for j = 1:size(file_list,1)
copyfile(file_list(j),destination_folder)
end

추가 답변 (1개)

Stephen23
Stephen23 2022년 8월 11일
편집: Stephen23 2022년 8월 11일

0 개 추천

"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

카테고리

도움말 센터File Exchange에서 File Operations에 대해 자세히 알아보기

태그

질문:

2022년 8월 11일

편집:

2022년 8월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by