compute mapping matrix between two label matrix

1 回表示 (過去 30 日間)
em
em 2015 年 7 月 17 日
回答済み: Muthu Annamalai 2015 年 7 月 17 日
I have a label matrix A, another label matrix B:
A = [1 1 1 2 3 3
1 1 2 2 3 3
4 1 2 2 3 3
4 4 5 5 5 5]
B = [10 10 12 12 12 11
10 10 12 12 11 11
14 14 12 11 11 11
14 14 7 7 7 12]
how can I compute a mapping matrix C such that C(A) is most similar to B. Each C(i) should take the major element of B(A==i). For example,
C = [10
12
11
14
7]
% means
% for B(A==1), most elements are 10.
% for B(A==2), most elements are 12.
% for B(A==3), most elements are 11.
% for B(A==4), most elements are 14.
% for B(A==5), most elements are 7.

採用された回答

Muthu Annamalai
Muthu Annamalai 2015 年 7 月 17 日
Try using the MATLAB function mode e.g.
mode( B(A==1) )
returns 10.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by