How to find the number of times an elements occurs in an array and copy to another array with same index
Show older comments
What I need is to find the number of times the elements repeat themselves in an array and copy the count to another array with the same index. I'll illustrate what i want by example:
A[4]=[1 4 6 1 5]
B[6]=[2 0 0 1 1 1]
Here,1 appears twice in A, so B[1]=2, 2 doesn't appear so B[2]=0, 3 doesn't appear so B[3]=0, 4,5 and 6 appear once so B[4]=1,B[5]=1,B[6]=1.
Accepted Answer
More Answers (0)
Categories
Find more on Data Types 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!