Error reading through all images in a directory

1 回表示 (過去 30 日間)
Teshan Rezel
Teshan Rezel 2020 年 2 月 26 日
コメント済み: Teshan Rezel 2020 年 2 月 26 日
Hi folks,
I'm trying to loop through all images in a directory but I get an error that my file doesn't exist, despite it definitely existing and the directory being correctly specified in matlab. Below is my code, can you spot what I'm doing wrong please?
destDir = 'F:\pet images\';
imageList = dir(fullfile(destDir, '*.tif'));
destinationPathName = 'F:\crops\';
for k = 1:numel(imageList)
currentImage = imageList(k).name;
img = imread(currentImage);
The code continues from here but it won't progress past this point as this is where my error lies.
thanks!

採用された回答

Bhaskar R
Bhaskar R 2020 年 2 月 26 日
currentImage = fullfile(imageList(k).folder, imageList(k).name);

その他の回答 (0 件)

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by