MATLAB Answers

0

Finding ALL the indicies that match a certain value

Asked by Abbi Hashem on 10 Dec 2018
Latest activity Answered by Star Strider
on 10 Dec 2018
Suppose I have a variable A= 4
and I have a vector B = [ 3 5 4 6 4 6 7 ]
I want to find the index of B that match A
that is , a vector with [ 3 , 5 ] since they are the third and 5th

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by Star Strider
on 10 Dec 2018

Use the find function:
A = 4;
B = [ 3 5 4 6 4 6 7 ];
idx = find(B == A)
producing:
idx =
3 5

  0 Comments

Sign in to comment.