MATLAB: How to replace any value into vector or matrix to -inf

MATLAB

ab =
11.0000
11.5000
12.0000
12.1000
12.2000
12.3000
11.2000
9.0000
9.5000
11.3000
ab<10
ans =
Columns 1 through 9
0 0 0 0 0 0 0 1 1
Column 10
0
ab1
ab1 =
Columns 1 through 5
11.0000 11.5000 12.0000 12.1000 12.2000
11.1000 11.4000 12.0000 12.1000 12.2000
Columns 6 through 10
12.3000 11.2000 9.0000 9.5000 11.3000
12.3000 11.2000 9.0000 9.5000 11.3000
>> ab1<10
ans =
Columns 1 through 9
0 0 0 0 0 0 0 1 1
0 0 0 0 0 0 0 1 1
Column 10
0
0
i want to replace ab<10 to -inf, without loop, and other variables and matrix size remains same. It should be applicable to any type of matrix.

Best Answer

ab(ab<10) = -inf;