1 |
function r = median(p,varargin) |
2 |
%overloaded gcmfaces median function : |
3 |
% 1) if single gcmfaces argument, then returns the global median over all faces |
4 |
% 2) if more than one argument, then simply calls double median function for |
5 |
% each face data, passing over the other arguments |
6 |
|
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=median(tmp1); |
14 |
return; |
15 |
end; |
16 |
|
17 |
r=p; |
18 |
|
19 |
for iFace=1:r.nFaces; |
20 |
iF=num2str(iFace); |
21 |
eval(['r.f' iF '=median(p.f' iF ',varargin{:});']); |
22 |
end; |
23 |
|
24 |
|