One way to create a logical matrix with true
for values inside bounds is using bsxfun
>> inBounds = bsxfun( @ge, A, lowerBound ) & bsxfun( @le, A, upperBound );
I used ge
(greater-equal) and le
(less than-equal) but you can use gt
(greater than) and/or lt
(less than) operators for the comparison.