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
Post a Comment