Filter löschen
Filter löschen

Invalid types for comparison.

2 Ansichten (letzte 30 Tage)
sun rise
sun rise am 25 Aug. 2022
Beantwortet: Benjamin am 26 Aug. 2022
load Group_Test
load labelIdx.mat
[c,cm,ind,per] = confusion(Group_Test1,labelIdx);
figure
cm = confusionchart(cm);
cm.ColumnSummary = 'column-normalized';
cm.RowSummary = 'row-normalized';
cm.Title = 'HOG Confusion Matrix';
Error using == (line 25)
Invalid types for comparison.
Error in confusion (line 45)
if ~all((targets==0) | (targets==1) | isnan(targets))
Error in Bysian_rule (line 3)
[c,cm,ind,per] = confusion(Group_Test1,labelIdx);
knowing that:
Group_Test 788x1 categorical
labelIdx.mat 788x1 categorical

Antworten (1)

Benjamin
Benjamin am 26 Aug. 2022
Hello,
Without having your function 'confusion.m', or at least the concerned lines, it can be difficult to help.
But I think the error says that you can't compare a categorical value (targets) with a boolean (1 or 0).
Maybe convert target into logical first, like this
targets = logical(targets);
Let me know if it worked.
Regards,

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by