It depends on what "x" is and what you want as output. Please post more details, because letting the readers guess the intention is not efficient.
Perhaps you want:
or
Mask = and(-5 < x, x < 3);
Maybe "x" is a symbolic variable or you want to use this as restriction for an optimization? Or you want to display the formula formatted by LaTeX in a title?
If you write "-3<x<5" directly, the result may be unexpected: Matlab evaluates this from left to right. "-3<x" is either TRUE or FALSE. In the next step you get "true<5" or "false<5", and because the logical values are treated as numerical 0 and 1, both relations are true independent from the value of x.
Best Answer