time | Calls | line |
---|
| | 1 | function c = countcats(a,dim)
|
| | 2 | %COUNTCATS Count occurrences of categories in a categorical array's elements.
|
| | 3 | % C = COUNTCATS(A), for a categorical vector A, returns a vector C containing
|
| | 4 | % the number of elements in A whose value is equal to each of A's categories.
|
| | 5 | % C has one element for each category in A.
|
| | 6 | %
|
| | 7 | % For matrices, COUNTCATS(A) is a matrix of counts. Each column of C contains
|
| | 8 | % counts for a column of A. For N-D arrays, COUNTCATS(A) operates along the
|
| | 9 | % first non-singleton dimension.
|
| | 10 | %
|
| | 11 | % C = COUNTCATS(A,DIM) operates along the dimension DIM.
|
| | 12 | %
|
| | 13 | % See also ISCATEGORY, ISMEMBER, SUMMARY.
|
| | 14 |
|
| | 15 | % Copyright 2013 The MathWorks, Inc.
|
| | 16 |
|
< 0.001 | 6 | 17 | if nargin < 2
|
< 0.001 | 6 | 18 | c = histc(a.codes,1:length(a.categoryNames));
|
| | 19 | else
|
| | 20 | c = histc(a.codes,1:length(a.categoryNames),dim);
|
< 0.001 | 6 | 21 | end
|
Other subfunctions in this file are not included in this listing.