find the number of elements in matrix

2 Ansichten (letzte 30 Tage)
alireza bakhshaee
alireza bakhshaee am 11 Apr. 2018
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 Kommentar
James Tursa
James Tursa am 11 Apr. 2018
Please provide a small sample of your table so we can see exactly what is in that 6th column.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Guillaume
Guillaume am 11 Apr. 2018
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)

Razvan Carbunescu
Razvan Carbunescu am 11 Apr. 2018
If using R2018a can use groupsummary with the first syntax:
GT = groupsummary(T,6)

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by