How to replace the non zero values of a matrix with another value? If there is a matrix 5*5 and it contains zero values, how can I keep the zero values and replace the non zero value with 0.1? in matlab version R2018a
Kshitij Singh answered .
2025-11-20
A(A ~= 0) == 0.1;
A = (A ~= 0)*0.1;