필터 지우기
필터 지우기

how to write a for loop in this case?

조회 수: 1 (최근 30일)
BN
BN 2020년 3월 25일
댓글: BN 2020년 3월 25일
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.

채택된 답변

KSSV
KSSV 2020년 3월 25일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by