Extract a range of data acording to the date range from a table
1 回表示 (過去 30 日間)
古いコメントを表示
I want to separate months of the year from a table into another table for each season.
3 件のコメント
採用された回答
Peter Perkins
2018 年 2 月 1 日
There's only four seasons, best to not overthink this.
spring = t(ismember(month(t.Time),1:3),:);
etc. But Guillaume's advice is worth thinking about.
3 件のコメント
Fraser McMurray
2018 年 2 月 7 日
編集済み: Fraser McMurray
2018 年 2 月 7 日
If you want to view a specific year you can try this:
april = x(ismember(month(x.time),4),:);
april2013 = april(ismember(year(april.time),2013),:);
Guillaume
2018 年 2 月 7 日
Again, it is very likely that you don't need to separate the table at all and that it may be more efficient to work on the whole table at once.
For example, if you wanted to calculate the mean wind speed per season per year:
[group, season, year] = findgroups(discretize(month(yourtable.time), [1 4 10 12]), year(yourtable.time));
meanwindspeed = splitapply(@mean, yourtable.windspeed, group);
result = table(season, year, meanwindspeed)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!