フィルターのクリア

How do I adjust this loop to the minute level?

4 ビュー (過去 30 日間)
Fatemah Ebrahim
Fatemah Ebrahim 2020 年 5 月 11 日
コメント済み: Fatemah Ebrahim 2020 年 5 月 11 日
So I have part of my code below running through a large Excel sheet of timeseries data to differentiate between average hourly weekend and weekday consumption by pulling the unique hour. I now want to run this again but incorporate the minutes along with the hours. I tried several different ways but to no prevail. Any help would be much appreciated.
for i = 1:length(UniqueTimeSteps)
HourValue(i) = UniqueTimeSteps(i);
[TimeValue,MinValue,Seconds] = hms(UniqueTimeSteps(i));
idx = (t.Hour == TimeValue & weekday(t) > 1 & weekday(t) < 7);
Consumption_Weekday(i) = mean(AptA(idx));
idx = (t.Hour == TimeValue & (weekday(t) == 1 | weekday(t) == 7));
Consumption_Weekend(i) = mean(AptA(idx));
end
  3 件のコメント
Fatemah Ebrahim
Fatemah Ebrahim 2020 年 5 月 11 日
The issue I'm having is with the hour and minute, with the code I have now I can do either or but not the two together.
Fatemah Ebrahim
Fatemah Ebrahim 2020 年 5 月 11 日
I tried running this code:
for i = 1:length(UniqueTimeSteps)
TimeValue(i) = UniqueTimeSteps(i);
[HourValue,MinValue,Seconds] = hms(UniqueTimeSteps(i));
idx = (t.Hour + t.Minute == HourValue & MinValue & weekday(t) > 1 & weekday(t) < 7);
Consumption_Weekday(i) = mean(A(idx));
idx = (t.Hour + t.Minute == HourValue & MinValue & (weekday(t) == 1 | weekday(t) == 7));
Consumption_Weekend(i) = mean(A(idx));
end
figureA = figure;
plot(TimeValue,Consumption_Weekday,'-*b');
hold on
plot(TimeValue,Consumption_Weekend,'--r');

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeTime Series Events についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by