How to check a number is in a array or not?
Show older comments
a=[8 9 6 5 3], I want to know 5 is there or not.
Accepted Answer
More Answers (1)
sum(a==5) > 0
any(a==5)
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!