필터 지우기
필터 지우기

find the number of elements in matrix

조회 수: 3 (최근 30일)
alireza bakhshaee
alireza bakhshaee 2018년 4월 11일
답변: Razvan Carbunescu 2018년 4월 11일
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
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
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)

Razvan Carbunescu
Razvan Carbunescu 2018년 4월 11일
If using R2018a can use groupsummary with the first syntax:
GT = groupsummary(T,6)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by