Let's say that I have an array of size n and each value in the array is a randomly generated value from 1 to 100. I'll use randi for this.
randi(100,n,1)
For example, lets says the array were a size 7 and the generated matrix was [30 17 94 28 28 19 19]. I want a method that can output a value of 4 since there area total of 4 values that are identical to another within the array. What is a simple though not necessarily the most efficient way of determining how the number of values that are identical?
Best Answer