MATLAB Answers

How to extract confusion-matrix from confusion-chart?

10 views (last 30 days)
Hassan Ashraf
Hassan Ashraf on 22 Jan 2020
Commented: Hassan Ashraf on 29 Jan 2020
I am using Neural Networks Toolbox. It allows me to plot confusion Chart by using "plotconfusion" command. But it does not allows me to see confusion matrix in the workspace. I tried to use "confusionchart" command but it pops up an error.
Error: Error using confusionchart (line 64)
Expected m to be a square matrix.
I have also attached both matrices of Targets and Outputs.
"t.mat" is a Target Matrix and "y.mat" is an output Matrix.


Sign in to comment.

Answers (1)

Mohammad Sami
Mohammad Sami on 23 Jan 2020
You need to use the function confusionmat
actual = t;
predicted = y;
mat = confusionmat(actual,predicted);


Show 2 older comments
Hassan Ashraf
Hassan Ashraf on 29 Jan 2020
Error using confusionmat (line 86)
First two arguments must be vectors or character matrices.
Mohammad Sami
Mohammad Sami on 29 Jan 2020
What is the type of your data ? The function accepts the following types
Data Types: single | double | logical | char | string | cell | categorical

Sign in to comment.

Sign in to answer this question.