Count elements/rows

Counts elements in N-DIM matrices & rows in max 2-DIM matrices
913 Downloads
Updated 15 Sep 2006

View License

This functions results in absolute and relative frequencies of elements in N-dimensional matrices or rows 2-dimensional matrices.

Example:

Example:
x = [Inf NaN NaN
1 2 3
1 2 -Inf
1 2 -Inf
1 2 3
1 2 5
Inf NaN NaN];

yr = count(x, 'rows')
yr =
1 2 -Inf 2 0.2857
1 2 3 2 0.2857
1 2 5 1 0.1429
Inf NaN NaN 2 0.2857

yr = count(x)
yr =
-Inf 2.0000 0.0952
1.0000 5.0000 0.2381
2.0000 5.0000 0.2381
3.0000 2.0000 0.0952
5.0000 1.0000 0.0476
Inf 2.0000 0.0952
NaN 4.0000 0.1905

Cite As

Elleke Janssen (2024). Count elements/rows (https://www.mathworks.com/matlabcentral/fileexchange/12283-count-elements-rows), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Line Plots in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0