how to solve this error Operands to the || and && operators must be convertible to logical scalar values?

1 view (last 30 days)
I am getting this error
Error using matlab.io.datastore.ImageDatastore/countEachLabel (line 27)
Operands to the || and && operators must be convertible to logical scalar values.
when i try to count each label in the folder I have loaded. Until 2 days ago it worked, now I don't understand what is wrong, can you help me please?
This is my code:
imds = imageDatastore('NuoveCategorie_agg2',...
'IncludeSubfolders',true, 'LabelSource','foldernames');
%%Display Class Names and Counts
tbl = countEachLabel(imds)
categories = tbl.Label;
and this is the code where there is the error:
function tbl = countEachLabel(imds)
try
if isempty(imds.Labels)
tbl = table;
return;
end
[u, c] = groupAndCountLabels(imds);
tbl = table(u, c, 'VariableNames', {'Label', 'Count'});
catch e
throw(e) *This is line 27*
end
end
  12 Comments
Paola Perrone
Paola Perrone on 22 Apr 2018
For the first one I have disinstalled and reinstalled matlab and I fixed it. For the second one, I try that code. Thank you so much

Sign in to comment.

Answers (0)

Categories

Find more on Denoising and Compression in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!