フィルターのクリア

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

5 ビュー (過去 30 日間)
Tan
Tan 2023 年 5 月 13 日
回答済み: Neeraj 2023 年 5 月 22 日
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 件のコメント
Tan
Tan 2023 年 5 月 13 日
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 2023 年 5 月 13 日
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

サインインしてコメントする。

回答 (1 件)

Neeraj
Neeraj 2023 年 5 月 22 日
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)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by