您可以查看两个选项:
A{1,1} = {'Monday 7/15';...
'Tuesday 8/01'; ...
'Wednesday 1/21';...
'Thursday 2/30';...
'Friday 11/02'};
A{2,1} = [0.1234; ...
0.2345; ...
0.3465; ...
0.4576; ...
0.5687];
B = {'Wednesday 1/21'; ...
'Friday 11/02'};
k = 1;
for i = 1:size(A{1,1},1)
for j = 1:size(B,1)
if strcmp(A{1,1}(i),B(j)) == 1
OZONE(k) = A{2,1}(i);
k = k + 1;
end
end
end
或者,可能更适合儒略日期格式:
A{1,1} = [1234.5; ...
2345.6; ...
3456.7; ...
4576.8; ...
5678.9];
A{2,1} = [0.1234; ...
0.2345; ...
0.3465; ...
0.4576; ...
0.5687];
B = [2345.6; ...
5678.9];
k = 1;
for i = 1:size(A{1,1},1)
for j = 1:size(B,1)
if A{1,1}(i) == B(j)
OZONE(k) = A{2,1}(i);
k = k + 1;
end
end
end
上面的两个循环示例之一应该允许您检查数据集以获取所需的日期。