I am using this code to get all images in a folder by user:
d = uigetdir(pwd, D);imagefiles = dir(fullfile(d, '*.jpg'));nfiles = length(imagefiles);
Then in a for loop I will do some calculations on the images:
k = 1:nfiles currentfilename = imagefiles(k).name; I = imread(currentfilename); . . .
when running the code I get this error:
Error using imread>get_full_filename (line 568)File "1.jpg" does not exist.Error in imread (line 377) fullname = get_full_filename(filename);Error in DemoBoundary29sept2018edit3ReadsImagesfromfolder (line 30) I = imread(currentfilename)
But 1.jpg exists in that folder. I think the reason is that the folder that the code is saved is different from folder that the images are.
Any idea how to solve the issue?
Best Answer