I am trying to make (what I thought would be) a simple if loop. Here is what I've tried; none work. I have a 384-by-384 matrix called clutter_mask which I need to use to create a same size matrix called dBZ_Mask which follows the given formula if clutter_mask ~= 0, otherwise it stays 0. What am I missing?
dBZ_Mask = clutter_mask * 0.375 + 66;if dBZ_Mask == 66 dBZ_Mask = 0;end%-------------------------
if clutter_mask ~= 0 dBZ_Mask = clutter_mask * 0.375 + 66;end%-------------------------dBZ_Mask(clutter_mask ~= 0) = clutter_mask * 0.375 + 66;%-------------------------dBZ_Mask = clutter_mask * 0.375 + 66;for i=1:384 for j=1:384 if dBZ_Mask(i,j) == 66 dBZ_Mask(i,j)=0; end endend
Best Answer