| 1 | gforget | 1.1 | function r = nanmin(p,varargin) | 
| 2 | gforget | 1.2 | %overloaded gcmfaces nanmin function : | 
| 3 |  |  | %  1) if single gcmfaces argument, then returns the global nanmin over all faces | 
| 4 | gforget | 1.3 | %  2) if two gcmfaces arguments, then returns the nanmin of the two at each point | 
| 5 |  |  | %  3) otherwise calls double nanmin function for each face, passing over the other arguments | 
| 6 | gforget | 1.1 |  | 
| 7 |  |  | if nargin==1; | 
| 8 |  |  | tmp1=[]; | 
| 9 |  |  | for iFace=1:p.nFaces; | 
| 10 |  |  | iF=num2str(iFace); | 
| 11 |  |  | eval(['tmp1=[tmp1;p.f' iF '(:)];']); | 
| 12 |  |  | end; | 
| 13 |  |  | r=nanmin(tmp1); | 
| 14 |  |  | return; | 
| 15 |  |  | end; | 
| 16 |  |  |  | 
| 17 | gforget | 1.3 | if isa(varargin{1},'gcmfaces'); | 
| 18 |  |  | r=p; | 
| 19 |  |  | for iFace=1:r.nFaces; | 
| 20 |  |  | iF=num2str(iFace); | 
| 21 |  |  | eval(['r.f' iF '=nanmin(p.f' iF ',varargin{1}.f' iF ');']); | 
| 22 |  |  | end; | 
| 23 |  |  | return; | 
| 24 |  |  | end; | 
| 25 |  |  |  | 
| 26 | gforget | 1.1 | r=p; | 
| 27 |  |  | for iFace=1:r.nFaces; | 
| 28 |  |  | iF=num2str(iFace); | 
| 29 |  |  | eval(['r.f' iF '=nanmin(p.f' iF ',varargin{:});']); | 
| 30 |  |  | end; | 
| 31 |  |  |  | 
| 32 |  |  |  |