MATLAB Answers

Ralf Sch
0

find and ismember are not working for one number in a vector

Asked by Ralf Sch
on 3 May 2013

Hey, I am new here and I searched a couple of time for my subject but I could not find anything. My question: I have a vector x=0.4:0.02:0.6; When I try to use "find" [find(x==0.42) --> empty matrix] or "ismember" [ismember(0.42,x) --> 0] to find the indexes of the numbers it is working for all number except the number 0.42. Can somebody tell me how that is possible and how I can solve this issue? Kind regards

Ralf

  0 Comments

Products

No products are associated with this question.

2 Answers

Answer by Ralf Sch
on 3 May 2013

But how can I solve this problem then?

  2 Comments

x=0.4:0.02:0.6;
find(abs(x-.42)<0.001)

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!