function [a,b]=maskswap(a,b,mask)
% MASKSWAP  Swap two matrices for masked elements
%	[a,b]=maskswap(a,b,mask) swaps the elements of matrices a and b if
%	the corresponding mask element is one.

dummy=a;
a=( mask) .* dummy + (~mask) .* b;
b=(~mask) .* dummy + ( mask) .* b;


