find the number of elements in matrix
2 次查看(过去 30 天)
显示 更早的评论
I have a table which contains 6 columns. In the 6th column, I have 3 types data: A , Ae , M I want to find: how many A, how many Ae and how many M I have in this column.
1 个评论
James Tursa
2018-4-11
Please provide a small sample of your table so we can see exactly what is in that 6th column.
回答(2 个)
Guillaume
2018-4-11
Should work regardless of the type of data in the 6th column:
[id, group] = findgroups(yourtable.nameof6column)
count = accumarray(id, 1);
%for pretty display
result = table(group, count)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!