MATLAB: How to fetch the column numbers in a vector

arrayfunctionindexindexingproblemprogramsumvector

Ok so I have vector v v= [0 1 0 2 6 2] through the operation c = numel(find(v==2)) I can find how many times the number 2 is repeated.
However, how can I make matlab tell me the column numbers where the 2 is repeated?
Could someone tell me please? I appreciate it greatly.

Best Answer

Just use find:
columns = find(v==2);