MATLAB: Corresponding index of an element

indexingMATLABmatrix manipulation

I have two vectors
g_counter = [2 0]
and
list = [3 0]
I would get the indices of all the elements belong to g_counter that have their position setted to zero and the corresponding position of list vector has to be setted to 0.
For instance with the given vectors I would get 2 as index. How can I do?

Best Answer

Maybe you want this
g_counter=[1 0 2 2 0]
list=[1 2 3 0 0]
idx=intersect(find(g_counter==0),find(list==0))
Related Question