variable format issue using copyfile
Show older comments
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!
Accepted Answer
More Answers (0)
Categories
Find more on File Operations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!