cannot find files error
조회 수: 2 (최근 30일)
이전 댓글 표시
I'm being asked to carry out analysis on images withing a dataset called ImageDatasets specifically looking at a folder withing this folder called DATASET 1. I'm using the code below yet it gives me the error saying it cannot find the files. I have taken this path directly from my computer so I don't understand why it cannot find the files. All files in dataset 1 are .jpg images.
imds = imageDatastore('C:/Users/donal/Desktop/ImageDatasets/DATASET 1/*.jpg');
Can anyone help me understand where I'm going wrong?
댓글 수: 1
Walter Roberson
2023년 3월 11일
To debug
location = 'C:/Users/donal/Desktop/ImageDatasets/DATASET 1/*.jpg';
pieces = strsplit(location, '/');
numpieces = length(pieces);
last_valid = 0;
for K = 1 : numpieces
sofar = fullfile(pieces{1:K});
dinfo = dir(sofar);
if isempty(dinfo); break; end
last_valid = K;
end
if last_valid == 0
fprintf('NOTHING in the path was found, not even the hard disk!\n');
else
fprintf('found up to "%s"\n', sofar);
if last_valid == numpieces
fprintf('which is the entire path\n');
else
fprintf('but not "%s"\n', pieces{last_valid+1});
end
end
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Special Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!