I need to change the name of all images in a folder to numerical values like 1.jpg, 2.jpg, …
I am using this code to do so:
selpath = uigetdir;imagefiles = dir(fullfile(selpath, '*.jpg'));% Loop through each
for id = 1:length(imagefiles) % Get the file name (minus the extension)
[~, f] = fileparts(imagefiles(id).name); movefile(f,num2str(id));end
I get this error:
Error using movefileNo matching files were found.Error in Rename_images (line 14) movefile(f,num2str(id));
Any idea of why? and how can I fix this?
Best Answer