Finding similar elements in a single matrix
古いコメントを表示
I have one matrix,
x = [
2 0 0
3 3 0
4 4 0
5 5 5
6 6 6]
How can I find the common elements between columns in the matrix and count them? for example, here 3 and 4 repeated two times.
4 件のコメント
Walter Roberson
2022 年 12 月 2 日
SUppose that row 3 column 3 were 2. Should that be considered a match to row 1 column 1? Or is it only a match if at least two columns of the same row are equal?
Should the 0 be counted as matches in row 1?
What should the output be? If there were another row at the end that was [3 0 3] for example, then should the overall output summarize that 3 occurred 4 times? But if so then should the 5 5 5 count as 3 because there are 3 elements? Should it count as 3 because columns (1,2) -> 1 match, columns (1,3) -> 1 match, colums (2,3) -> 1 match, total 3? So if there were 4 rows all identical items the match count for the row should be 6?
Md. Nazrul Islam Siddique
2022 年 12 月 2 日
Walter Roberson
2022 年 12 月 2 日
Md. Nazrul Islam Siddique
2022 年 12 月 2 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!