フィルターのクリア

I want to extract cell array

2 ビュー (過去 30 日間)
Habtamu Tsegaye
Habtamu Tsegaye 2022 年 4 月 13 日
回答済み: Habtamu Tsegaye 2022 年 4 月 13 日
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

回答 (2 件)

Walter Roberson
Walter Roberson 2022 年 4 月 13 日
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 2022 年 4 月 13 日
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.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by