| Statistics Toolbox™ | ![]() |
summary(A)
C = summary(A)
[C,labels] = summary(A)
summary(A) displays the number of elements in the categorical array A equal to each of the possible levels in A. If A contains any undefined elements, the output also includes the number of undefined elements.
C = summary(A) returns counts of the number of elements in the categorical array A equal to each of the possible levels in A. If A is a matrix or N-dimensional array, C is a matrix or array with rows corresponding to the levels of A. If A contains any undefined elements, C contains one more row than the number of levels of A, with the number of undefined elements in c(end) or c(end,:).
[C,labels] = summary(A) also returns the list of categorical level labels corresponding to the counts in C.
Count the number of patients in each age group in the data in hospital.mat:
load hospital
edges = 0:10:100;
labels = strcat(num2str((0:10:90)','%d'),{'s'});
AgeGroup = ordinal(hospital.Age,labels,[],edges);
[c,labels] = summary(AgeGroup);
Table = dataset({labels,'AgeGroup'},{c,'Count'});
Table(3:6,:)
ans =
AgeGroup Count
'20s' 15
'30s' 41
'40s' 42
'50s' 2islevel, ismember, levelcounts
![]() | stepwisefit | summary | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |