variable format issue using copyfile
显示 更早的评论
Hello Matlab community!
I am having what is probably a really simple issue using copyfile that I can't seem to debugg so hoping someone can help.
I am simply trying to copy an image file from one folder to another using specific paths. The code is here:
finalImgStr = (['RUN0',sprintf('%d',i), '_plot_0020.jpg']);
outputDir = ([projfilepath, '\Output\Run', sprintf('%d',i)]);
finalImg = fullfile(outputDir, finalImgStr);
finalImg1 = convertCharsToStrings(finalImg);
destDir1 = convertCharsToStrings(destDir);
copyfile ('finalImg1', 'destDir1');
When I try and run it I get an error saying 'no matching files were found'. However I have checked all the variables and the file paths are correct, and the image is in the source directory etc.
The variables were initially character arrays hence I have converted them to string array's (although the error is the same even if I leave them as characters...)
I'm assuming it's something to do with the formatting/data types but I can't work it out so any help would be appreciated!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 File Operations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!