MATLAB: Replacing components of a matrix

MATLABmatricesmatrixmatrix manipulation

how to generate a matrix that replaces all components of a previous matrix lying between 2.9 and 3.2, by -1?

Best Answer

%your matrix is M
isBetween = (M >= 2.9) & (M <= 3.2);
M(isBetween) = -1
Related Question