Warning, /verification/tutorial_global_oce_latlon/diags_matlab/sq.m is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
051ee7f715 Jean*0001 % sq(A) is similar to squeeze(A) except that elements =0 are set to NaN
0002 %
0003 % sq(A) 0 -> NaN
0004 % sq(A,val1) val1 -> NaN
0005 % sq(A,val1,val2) val1 -> val2
0006
0007 function [A] = sq(B,varargin);
0008 A=squeeze(B);
0009 if nargin>=2
0010 nodata=varargin{1};
0011 else
0012 nodata=0;
0013 end
0014 if nargin==3
0015 newval=varargin{2};
0016 else
0017 newval=NaN;
0018 end
0019 %A(find(A==nodata))=A(find(A==nodata))*NaN;
0020 A(find(A==nodata))=newval;