#2 Correction to "Zero out elements above 5.5" in MATLAB

open
nobody
None
5
2014-08-16
2010-01-19
No

A .* (A>5.5) makes zero all elements of A that are BELOW or EQUAL to 5.5 (because A>5.5 produces a size(A) matrix with 1 in place of elements > 5.5 and with zeros otherwise).

There are many ways to correct this: A .* ~(A > 5.5) or A .* (A <= 5.5) or even A(A > 5.5) = 0. The latter is the most clear, in my opinion.

Discussion