jeudi 5 février 2015

If statement Matlab

I have the following code



for a = 1:38;
for b = 1:41;
if distance(a,b)== 0;
distance(a,b) == 1;
end
end
end


Its for a 38x41 matrix. The matrix has numbers and zero values. How do I write an if statement that will convert any zero value to 1. I can't see why the above code will not work.


Regards, Jer


Aucun commentaire:

Enregistrer un commentaire