1 |
gforget |
1.1 |
function [MITprof]=MITprof_concat(MITprof1,MITprof2); |
2 |
|
|
% [MITprof]=MITprof_concat(MITprof1,MITprof2); |
3 |
|
|
% concatenates MITprof1 and MITprof2, which mut |
4 |
|
|
% have the same vertical grid |
5 |
|
|
|
6 |
|
|
MITprof=MITprof1; |
7 |
|
|
fldNames=fieldnames(MITprof); |
8 |
|
|
|
9 |
|
|
%check that the vertical grids of MITprof1 and MITprof2 are the same: |
10 |
|
|
%-------------------------------------------------------------------- |
11 |
|
|
tmp1=MITprof1.prof_depth; tmp2=MITprof2.prof_depth; |
12 |
|
|
if length(tmp1)~=length(tmp2); |
13 |
|
|
error('vertical grids differ => cannot concatenate'); |
14 |
|
|
else; |
15 |
|
|
if sum(tmp1~=tmp2)>0; |
16 |
|
|
error('vertical grids differ => cannot concatenate'); |
17 |
|
|
end; |
18 |
|
|
end; |
19 |
|
|
|
20 |
|
|
%concatenate: |
21 |
|
|
%------------ |
22 |
|
|
for iFld=1:length(fldNames); |
23 |
|
|
eval(['tmp1=MITprof1.' fldNames{iFld} ';']); |
24 |
|
|
eval(['tmp2=MITprof2.' fldNames{iFld} ';']); |
25 |
|
|
if ~strcmp(fldNames{iFld},'prof_depth'); |
26 |
|
|
tmp1=[tmp1;tmp2]; |
27 |
|
|
end; |
28 |
|
|
eval(['MITprof.' fldNames{iFld} '=tmp1;']); |
29 |
|
|
end; |
30 |
|
|
|
31 |
|
|
%add a couple things: |
32 |
|
|
%-------------------- |
33 |
|
|
MITprof.np=length(MITprof.prof_lon); |
34 |
|
|
MITprof.nr=length(MITprof.prof_depth); |
35 |
|
|
|