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

1 visualización (últimos 30 días)
BN
BN el 29 de Mzo. de 2020
Comentada: BN el 29 de Mzo. de 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 comentarios
Walter Roberson
Walter Roberson el 29 de Mzo. de 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

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by