フィルターのクリア

How to label axis in confusion matrix ?

2 ビュー (過去 30 日間)
Abhishek H P
Abhishek H P 2016 年 6 月 21 日
編集済み: Stephen23 2016 年 6 月 21 日
I have confusion matrix as below
[3 0 0
1 2 0
0 0 3]
Please let me know
A B C
A 3 0 0
B 1 2 0
C 0 0 3
A,B,C are the labels

回答 (1 件)

Stephen23
Stephen23 2016 年 6 月 21 日
編集済み: Stephen23 2016 年 6 月 21 日
M = [3,0,0;1,2,0;0,0,3];
L = {'A','B','C'};
X = [L(:),num2cell(M,2)]';
fprintf(' %3s %3s %3s\n',L{:})
fprintf('%3s %3d %3d %3d\n',X{:})
prints this:
A B C
A 3 0 0
B 1 2 0
C 0 0 3
You can adjust the spacing to suit your data and strings by changing the field width of the conversion operators.

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by