How do I create a for loop to group data?

2 ビュー (過去 30 日間)
Lui
Lui 2019 年 3 月 13 日
コメント済み: Sheng Chen 2019 年 3 月 13 日
Hello everyone
I have set a set of annual data which I would like to group into seasons. I can do this through concatenation of the individual months as below:
jan= SUNdat(1==month(SUNdat.Date),:);
feb= SUNdat(2==month(SUNdat.Date),:);
mar= SUNdat(3==month(SUNdat.Date),:);
dec= SUNdat(12==month(SUNdat.Date),:);
Summer=[jan;feb;mar;dec];
This is a longer way. So instead I a trying to implement a for loop as below but it is not working
n=1:3;
for n=3
summer=SUNdata(n==month(SUNdat.Date),:);
n=n+1;
end
This returns an error. How else can I implement this to be able to group my data as explained
  2 件のコメント
madhan ravi
madhan ravi 2019 年 3 月 13 日
could you provide a sample data?
Sheng Chen
Sheng Chen 2019 年 3 月 13 日
Could you please also provide the error message?

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by