for loop with 3 variables
古いコメントを表示
xvirtual = [250:10:300]
for jj = 1:length(xvirtual)
for j = 50000:50100 %:length(Z(:,1))
for i = xvirtual(jj):length(xq(1,:))-1
V(j,i) = pointdistance*(Z(j,i)-Zq(i));
end
Volume(j) = sum(V(j,:) ,'omitnan'); % virtual overtopping volumes in time
end
Vis(jj,:) = Volume;
end
Hi hope someone can help me with this code. I want to loop through time=j, the space =i and different xvirtual levels = jj. As result I get Vis, however this result contains the same volumes for all rows. So probably it is only calculating for the first xvirtual=250. How can I calculate for the other values of xvirtual?
4 件のコメント
Adam
2019 年 2 月 4 日
Why are you indexing j from 50000? This will create V and Volume variables vastly bigger than required, with 0s form the previous 49999 elements/rows.
ceycey
2019 年 2 月 4 日
Cris LaPierre
2019 年 2 月 4 日
編集済み: Cris LaPierre
2019 年 2 月 4 日
Hard to say without knowing more about the other variable: pointdistance, Z, Zq and xq. Can you attach a mat file containing them? Or at least provide info on their size?
ceycey
2019 年 2 月 5 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!