Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
BN
BN le 29 Mar 2020
Commenté : BN le 29 Mar 2020
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 commentaires
Walter Roberson
Walter Roberson le 29 Mar 2020
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

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by