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 |
gforget |
1.2 |
% |
6 |
gforget |
1.1 |
|
7 |
|
|
MITprof=MITprof1; |
8 |
|
|
fldNames=fieldnames(MITprof); |
9 |
|
|
|
10 |
|
|
%check that the vertical grids of MITprof1 and MITprof2 are the same: |
11 |
|
|
%-------------------------------------------------------------------- |
12 |
|
|
tmp1=MITprof1.prof_depth; tmp2=MITprof2.prof_depth; |
13 |
|
|
if length(tmp1)~=length(tmp2); |
14 |
|
|
error('vertical grids differ => cannot concatenate'); |
15 |
|
|
else; |
16 |
|
|
if sum(tmp1~=tmp2)>0; |
17 |
|
|
error('vertical grids differ => cannot concatenate'); |
18 |
|
|
end; |
19 |
|
|
end; |
20 |
|
|
|
21 |
|
|
%concatenate: |
22 |
|
|
%------------ |
23 |
|
|
for iFld=1:length(fldNames); |
24 |
|
|
eval(['tmp1=MITprof1.' fldNames{iFld} ';']); |
25 |
|
|
eval(['tmp2=MITprof2.' fldNames{iFld} ';']); |
26 |
|
|
if ~strcmp(fldNames{iFld},'prof_depth'); |
27 |
|
|
tmp1=[tmp1;tmp2]; |
28 |
|
|
end; |
29 |
|
|
eval(['MITprof.' fldNames{iFld} '=tmp1;']); |
30 |
|
|
end; |
31 |
|
|
|
32 |
|
|
%add a couple things: |
33 |
|
|
%-------------------- |
34 |
|
|
MITprof.np=length(MITprof.prof_lon); |
35 |
|
|
MITprof.nr=length(MITprof.prof_depth); |
36 |
gforget |
1.2 |
MITprof.list_descr=unique(MITprof.prof_descr); |
37 |
|
|
MITprof.nd=length(MITprof.list_descr); |
38 |
gforget |
1.1 |
|