MATLAB Answers

0

How to check a number is in a array or not?

Asked by Arnab Pal on 29 Aug 2017
Latest activity Edited by José-Luis
on 29 Aug 2017
a=[8 9 6 5 3], I want to know 5 is there or not.

  0 Comments

Sign in to comment.

Tags

2 Answers

Answer by Guillaume
on 29 Aug 2017
 Accepted Answer

ismember(5, a)

  0 Comments

Sign in to comment.


Answer by José-Luis
on 29 Aug 2017
Edited by José-Luis
on 29 Aug 2017

sum(a==5) > 0
any(a==5)

  0 Comments

Sign in to comment.