-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathformatDataFunc.m
More file actions
28 lines (21 loc) · 827 Bytes
/
Copy pathformatDataFunc.m
File metadata and controls
28 lines (21 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function [] = formatDataFunc(inputDataName, outputDataString)
S = load(inputDataName);
fieldNames = fieldnames(S);
fieldName = fieldNames{1};
Obs = S.(fieldName);
station1Vec = [Obs(:,2), Obs(:,5)];
station2Vec = [Obs(:,3), Obs(:,6)];
station3Vec = [Obs(:,4), Obs(:,7)];
observations = [];
for i = 1:length(station1Vec)
if ~isnan(station1Vec(i,1))
observations = [observations; Obs(i,1), 1, Obs(i,2), Obs(i,5)];
elseif ~isnan(station2Vec(i,1))
observations = [observations; Obs(i,1), 2, Obs(i,3), Obs(i,6)];
elseif ~isnan(station3Vec(i,1))
observations = [observations; Obs(i,1), 3, Obs(i,4), Obs(i,7)];
end
end
measurements = sortrows(observations,1);
save(outputDataString, 'measurements');
end