This is the program that I have tested:
% Get a list of all files in the folder with the desired file name pattern.
filePattern = fullfile('C:\Program Files\MATLAB\R2009a\bin\fundus\*.jpg'); imagefile = dir(filePattern);nfiles=length(imagefile)for k = 1 : nfiles imageName = imagefile(k).name; fullFileName = fullfile('C:\Program Files\MATLAB\R2009a\bin\fundus\*.jpg', imageName); fprintf(1, 'Now reading %s\n', fullFileName) % Now do whatever you want with this file name,
% such as reading it in as an image array with imread()
imageArray = imread('C:\Program Files\MATLAB\R2009a\bin\fundus\*.jpg'); imshow(imageArray); % Display image.
drawnow; % Force display to update immediately.
end
and error comes as following:
nfiles = 70Now reading C:\Program Files\MATLAB\R2009a\bin\fundus\*.jpg\im.jpg??? Error using ==> imread at 357Can't open file "C:\Program Files\MATLAB\R2009a\bin\fundus\*.jpg"for reading;you may not have read permission.Error in ==> see at 11 imageArray = imread('C:\Program Files\MATLAB\R2009a\bin\fundus\*.jpg');
Best Answer