フィルターのクリア

Select only January and April months among 30 years monthly data (how to filter?)

2 ビュー (過去 30 日間)
BN
BN 2020 年 3 月 29 日
コメント済み: BN 2020 年 3 月 29 日
Hey all,
I have a cell (1 x 92) which includes 92 tables . In each table I have a column named dates. I want to filter the whole table based on January and April. I wish if it is possible have the value of January and April as 2 column after all existing column in each table (cell array), for example:
Thank you so much
  6 件のコメント
Walter Roberson
Walter Roberson 2020 年 3 月 29 日
jan_rrr24 and april_rrr24 are already the extracted rrr24 values for the respective months.
You cannot construct a table that contains both jan_rrr24 and april_rrr24 entries because there are a different number of days in January (31) than in April (30) so you will not have the same number of rows for the two.
nCELL = numel(CELL);
newCELL = cell(nCELL, 2);
for i=1:nCELL
date_month = month(CELL{i}.dates);
jan_mask = date_month == 1;
april_mask = date_month == 4;
jan_rrr24 = CELL{i}.rrr24(jan_mask);
april_rrr24 = CELL{i}.rrr24(april_mask);
newCELL{i,1} = jan_rrr24;
newCELL{i,2} = april_rrr24;
end
BN
BN 2020 年 3 月 29 日
Thank you !

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by