MATLAB Answers

how to write a for loop in this case?

1 view (last 30 days)
Behzad Navidi
Behzad Navidi on 25 Mar 2020
Commented: Behzad Navidi on 25 Mar 2020
Hey all,
I have a 30x1 cell. I want to convert these hourly cells to daily so I used this line:
daily_tmax = squeeze(mean(reshape(tmax{1,1}, size(tmax{1,1}, 1), size(tmax{1,1}, 2), 24, []), 3));
This line workes well but only convert the first cell array. I want to know how to write a loop in order to generalize this line for the whole cell. The file is too large to attach but here is the screenshot:
Really Thank you.

  0 Comments

Sign in to comment.

Accepted Answer

KSSV
KSSV on 25 Mar 2020
daily_tmax = cell(length(tmax),1) ;
for i = 1:length(tmax)
daily_tmax{i} = squeeze(mean(reshape(tmax{i}, size(tmax{i}, 1), size(tmax{i}, 2), 24, []), 3));
end

  1 Comment

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags

Products


Release

R2018b