% composite.m Steve Mann % % like chnan except changes NaNs to a second image. % % Example: C = composite(A,B); % anywhere A=NaN, you see B instead function C = matrixversionofchnan(A,B); if nargin < 2 error('composite: you must specify 2 input images') end%if Amin=min2nan(A); Aextended=chnan(A,Amin-1); whereisNaN=Amin-min(Aextended,ones(size(A))*Amin); % 1 where image is NaN C=(1-whereisNaN).*Aextended + whereisNaN.*B;