Filter löschen
Filter löschen

Cannot find files or folders matching: 'recycle10​1\project\​aluminiumc​an'.

5 Ansichten (letzte 30 Tage)
Tan
Tan am 13 Mai 2023
Beantwortet: Neeraj am 22 Mai 2023
clc
clear all; close all;
outputFolder=fullfile('recycle101');
rootFolder=fullfile(outputFolder,'project');
categories={'aluminiumcan','petbottles','drinkcartonbox'};
imds=imageDatastore(fullfile(rootFolder,categories),'LabelSource','foldernames');
tbl=countEachLabel(imds)
Error:
>> imds=imageDatastore(fullfile(rootFolder,categories),'LabelSource','foldernames');
tbl=countEachLabel(imds)
Error using imageDatastore
Cannot find files or folders matching: 'recycle101\project\aluminiumcan'.
  4 Kommentare
Tan
Tan am 13 Mai 2023
but my MATLAB install at hard-disk and the dataset is saved at local disk.
Does it will affect and get the error as below?
Error using imageDatastore
Cannot find files or folders matching: 'recycle101\project\aluminiumcan'.
Walter Roberson
Walter Roberson am 13 Mai 2023
what does this report?
parts = {'recycle101', 'project', 'aluminiumcan'};
if exist(parts{1}, 'dir')
fprintf('folder "%s" exists!\n', parts{1});
if exists(fullfile(parts{1:2}), 'dir')
fprintf('folder "%s" exists!\n', fullfile(parts{1:2}));
if exists(fulfile(parts{1:3}), 'dir')
fprintf('folder "%s" exists!\n', fullfile(parts{1:3}));
else
fprintf('but could not find subfolder "%s"\n', parts{3});
end
else
fprintf('but could not find subfolder "%s"\n', parts{2});
end
else
fprintf('folder "%s" does not exist in current directory!\n', parts{1});
end

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Neeraj
Neeraj am 22 Mai 2023
Hello,
The error clearly states that 'imageDatastore' is unable to find the files/folders located at location 'recycle101\project\aluminiumcan'
Please ensure that the relative path: 'recycle101\project\aluminiumcan' exists.
If it does exist, then try to pass the absolute path to the 'imageDatastore' which might look similar to: 'C:\Users\OneDrive\Desktop\recycle101\project\aluminiumcan'
If the absolute path works without any error, then you only need to modify the 'outputFolder' variable as shown below:
clc
clear all; close all;
outputFolder=fullfile('C:\Users\OneDrive\Desktop\recycle101');
rootFolder=fullfile(outputFolder,'project');
categories={'aluminiumcan','petbottles','drinkcartonbox'};
imds=imageDatastore(fullfile(rootFolder,categories),'LabelSource','foldernames');
tbl=countEachLabel(imds)

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by