フィルターのクリア

Create a new matrix with the for loop

1 回表示 (過去 30 日間)
Sophia
Sophia 2018 年 6 月 19 日
回答済み: Dennis 2018 年 6 月 20 日
w_u = zeros(361,361,252);
w_v = zeros(361,361,252);
ind = 10:16;
for t = 1:length(nu1) %nu1 and nv1 are 361*361*436 in size
if t <=36
%the months required in the analysis are 252
w_u = nu1(1:361,1:361,ind);
*Here is the problem, i understand every time the loop iterates it creates a matrix of the size 361*361*7. I am not sure how to save this matrix and keep adding on to the same matrix until i have the required matrix of the size 361*361*252*
tu(:,:,t:t+6) = w_u;
w_v = nv1(1:361,1:361,ind);
tv(:,:,t+6) = w_v;
% end
ind = ind+12;
else
end
end
  4 件のコメント
Stephen23
Stephen23 2018 年 6 月 20 日
@Dennis: you should put that as an answer.
Sophia
Sophia 2018 年 6 月 20 日
編集済み: Stephen23 2018 年 6 月 20 日
@Dennis: Yes, you interpreted it correctly. and Thank you,that's the right answer. Can you post it as answer so i can accept this

サインインしてコメントする。

採用された回答

Dennis
Dennis 2018 年 6 月 20 日
If (big if) i interpreted your code right you are trying to do something like this:
w_u = zeros(361,361,252);
w_v = zeros(361,361,252);
ind=10:16;
for t= 1:36 %252/7=36
idx =(t-1)*12+ind;
w_u(:,:,(t-1)*7+(1:7)) = nu1(:,:,idx);
w_v(:,:,(t-1)*7+(1:7)) = nv1(:,:,idx);
end
Glad i could help :)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by