I intend to avoid dividing by zero, by re-assigning a different value to a entry that is zero in a divisor matrix. In the following code I want to search for that entry of A which equals zero (being A(7) in this case), and give it a value that is greater then zero but smaller than all other non-zero entries (which is A(3)=9 in this case). I am trying a if-statement as can be seen --- which seems WRONG. Where should I fix?
% code begin clear;clc;
a = [3; 2; 1; 3; 4; 5; 1] A = [12; 11; 9; 13; 67; 44; 0]
min(A(A~=0)) = A(A==0) % trying to set the zero values in divisor matrix to the min non-zero entry?