Count Relationships between two columns
1 次查看(过去 30 天)
显示 更早的评论
I'd like to count how many links a first column number is to a second column number, and so on. For example, how many times the number 1da first column has the number 1 in the second column?
0 个评论
采纳的回答
Walter Roberson
2015-6-23
maxdata = max(max(Yourdata(:,1:2)));
counts = accumarray(YourData(:,1:2), 1, [maxdata, maxdata]);
Now counts(J,K) is the number of times the number J appeared in the first column with K in the second column of the same row.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!