MATLAB Answers

0

Using find between two points

Asked by Darpan Verma on 11 Mar 2019
Latest activity Commented on by Darpan Verma on 11 Mar 2019
Hello Everyone,
I am trying to use find in between two points, which is giving me error.
When I use
index = find(x>4)
it gives me all 100 values which are greater than x>4
if I use
index = find((x>4) && (x<6))
It gives me error: Operands to the || and && operators must be convertible to logical scalar
values.
I wanted to know how I can find the values by giving two conditions.

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by David Goodmanson on 11 Mar 2019
 Accepted Answer

Hi Darpan,
try it with just one & sign. && is for scalar comparisons, and you have a vector on each side.

  1 Comment

Thanks David That worked. :)

Sign in to comment.