|
Dear all,
Here is my code to supplement missing data in the specific time based on the index.
Can you advice me or provide me some hints how to write the part of control flow? I already try several way, but I need to pick up some clues.
Thanks so much.
Michael
load ('data_A_2007');
load ('data_B_2007');
load ('data_C_2007');
year = 2007;
doy=yeardays(year);
[L W] = size(year);
if L < W;
year = year';
[L W] = size(year);
end
ind = [1:1:L]';
start_time = datenum(year(ind(1)), 1, 1) + step/1440;
end_time = datenum(year(ind(L))+1, 1, 1);
time_vector = [start_time : step/1440 : end_time]';
base_vector = floor(time_vector(1,:));
day_vector = time_vector - base_vector - doy;
% summer time : doy >=91 and <=275; night time hour: 6 - 19
% winter time : doy <90 and >275; night time hour: 7 - 18
for day_vector(1:90*24*2 & 275*24*2:end)
night_index = find(floor(day_vector)< 7/24 | floor(day_vector)> 18/24);
else
night_index = find(floor(day_vector)< 6/24 | floor(day_vector)> 19/24);
end
night_missingdata_index = find(data_A_2007(night_index) & isnan(data_B_2007));
data_A_2007(night_missingdata_index) = data_C_2007(night_missingdata_index);
|