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

 Accepted Answer

ismember(5, a)

2 Comments

Excuse me Sir,
For the same problem, if we don't know that the number is 5, how to code to get that the number is 5?
Putri, you can just as easily use a variable. That is, ismember(x,a) would work as well, where the value of x is assigned earlier in the script.

Sign in to comment.

More Answers (1)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!