MATLAB: Do i get this error ?

batch processingimage processingImage Processing Toolboximread

I am trying to run a batch process and i get this error while reading, why is that ??
files = dir('C:\Project\Research\Image\Reel_3\*.tif');
for k = 1:numel(files)
I = imread(files(k).name);
Error using imread (line 349)
File "00585_1u.tif" does not exist.
Error in FaultImageFind (line 3)
I = imread(files(k).name)
Those files do exist in the folder and i could get all the info using files(), files().name but i just wonder why it throws an error while reading ? Could be a silly mistake but can't figure it out!!

Best Answer

  • folder = 'C:\Project\Research\Image\Reel_3';
    files = dir(fullfile(folder, '*.tif'));
    I = imread(fullfile(folder, files(k).name));