Mazzy
Mazzy

Reputation: 14179

getting index element

I have two vectors

g_counter = [2 0]

and

list = [3 0]

I would get this:

  1. select all the elements of g_counter that have the corrisponding values equals to zero in list vector.

2 has the corresponding value in list vector not to zero so I will not get it. I will get 0 that have the corresponding value in list vector equals to zero

0
  1. getting the index of this element in g_counter vector.

    2

Upvotes: 0

Views: 174

Answers (1)

Maroun
Maroun

Reputation: 95948

From what I've understood you should do something like that:

zeros=find(list==0);
g_counter(zeros) %this will print the values for which the index is 0 in the vector list

Upvotes: 1

Related Questions