function result = dotmmask(mask)
%result = dotmmask(mask)
%
% return a mask suitable for dot-multiplication (i.e. 1 if good, NaN if bad)
%            from a logical mask (i.e. 1 if bad, 0 of good) 
%            (also works for any positive integer used as a flag)
% eg. badmask = vel > threshold;
% plot(vel(~badmask))        %but this is a vector now
% % could be changed to 
% plot(vel.*dotmmask(badvals))  %this is a matrix with NaNs for bad vals
% 
% NOTE: if original data were NaNs, take those as flagged


nani = find(isnan(mask));
mask(nani) = 1;                     %they will be converted back to NaN below



result = zeros(size(double(mask)));
result(mask == 0) = 1;            %these were not chosen as bad
result(mask ~= 0) = NaN;          %these were chosen as bad





