MATLAB: How to compare each element of matrix

matlab codermatrixmatrix array

here…i taken some variable as t ,value is 4(t=4),and f is a 4×4 matrix.. f=[1 2 3 4; 2 3 4 5 ; 5 6 7 8 ; 1 2 3 5].. how to compare the each element of matrix with T?

Best Answer

t = 4;
f = [1 2 3 4; 2 3 4 5 ; 5 6 7 8 ; 1 2 3 5];
out = abs(f - t) < eps(100)
ADD
out = f;
out(f <= t) = -4;