Effacer les filtres
Effacer les filtres

I want to extract cell array

1 vue (au cours des 30 derniers jours)
Habtamu Tsegaye
Habtamu Tsegaye le 13 Avr 2022
I do have 1x7 cell arraiy which contain 5488x4. 1st col is year, 2nd col is month, 3rd isday and 4th is the dily rainfall. I want to extract the daily data from each cell and make other cell aray contain 7 daily rainfall elements. How can I do the code? here is my data
it is my trial
for i=1:length(unistsrfr1)
for j = 1:5844
dy_strfr1= rfdata_tsstrfr1{1,i}(1:j,4);
yy= rfdata_tsstrfr1{1,1}(1:j,1);
mm= rfdata_tsstrfr1{1,1}(1:j,2);
dd= rfdata_tsstrfr1{1,1}(1:j,3);
datenum(yy,mm,dd,0,0,0)
end
end

Réponses (2)

Walter Roberson
Walter Roberson le 13 Avr 2022
rf_cell = cellfun(@(C) [datenum(C(:,1), C(:,2), C(:,3)), C(:,4)], unistsrfr1, 'uniform', 0);
The result, rf_cell, will be a 1 x 7 cell array, each entry of which is a 5488 x 2 double, with the first column containing the datenum and the second column containing the rainfall.
Note: these days we recommend that you use datetime() objects instead of datenum()

Habtamu Tsegaye
Habtamu Tsegaye le 13 Avr 2022
The result, rf_cell, will be a 1 x 7 cell array, each entry of which is a 5488 x 2 double. I do not need 5488X2double. what I need is 1X7 or 7X1 rainfall elements taken (one by one) from each 1X7cell array in the data attached.

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by