MATLAB: To find the position of the elements which are same in vector

accumarrayarrayfunhistc

I have a vector like this: a = [ 2 3 4 2 5 4 3 3]; and I want to find all the index of the elements which has the same value. output like this: # 2, [1 4] # 3, [2 7 8] # 4, [3 6] # 5, [5]

Best Answer

find(a==2)