how can we calculate count of specific group in a row

1 次查看(过去 30 天)
i have a matric
3 2 5,
3 2 5,
4 2 5,
4 2 5,
4 2 5,
i need output like this 3 2 5 *2*- where 2 and 3 of times occured
4 2 5 *3*

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2016-8-22
A=[3 2 5,
3 2 5,
4 2 5,
4 2 5,
4 2 5]
[ii,jj,kk]=unique(A,'rows','stable')
out=[ii,accumarray(kk,1)]
  1 个评论
abdul wahab  aziz
abdul wahab aziz 2016-8-22
thanks for answer aziz abdelmalek i need another help now i have grouping is done i want to get most counted col value
e.g 3 2 5-6 3 2 6 -7 so i must be able to access second row 3 2 6 e.g i need its value 2

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by