matlab - Check if set values exists in Matrix -


the matrix <1x500> contains different values, trying if-statement check if there 3 different values, lets somewhere must contain 30, 40 , 50 in order evaluate true. don't have come in order.

i tried:

if any(val == 30) && any(val == 40) && any(val == 50)    stuff 

but it's not working intended, seems evaluate true if 1 of values exists.

you have , unnecessary all in there. can use simply

if any(val == 30) && any(val == 40) && any(val == 50) 

alternately, use ismember simultaneously check values in input.

if ismember([30 40 50], val) 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -