how many times matrix elements are repeated
Show older comments
Dear all! I am looking for a fast algorithm to count how many times elements in huge matrices are repeated. Example: Input{1 0 2}{1 1 2}, answer would be: 1 = 3, 2 = 2.
I will extremly appreciate your help!
Answers (1)
A = [1 0 2; 1 1 2]
nnz(A == 1)
nnz(A == 2)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!