FOR loop skipping to a particular iteration
古いコメントを表示
for i=2:1:(length(time_c)-1)
if wheelpower_c(i)>= 0
propulsionpower(i)=propulsionpower(i-1)+wheelpower_c(i);
Regenpower(i)=Regenpower(i-1);
Brakeloss(i)=Brakeloss(i-1);
I(i)=(Voc-sqrt((Voc^2)-(4*R.*batterypower_city(i))))/(2*R);
Soc(i)=Soc(i-1)-(I(i)*DT/battery_capacity_C);
V(i)=Voc-R*I(i);
this a part of my for loop and i wanna check whether my conditions hold at i=576 can i skip to that particular iteration? Thank you
length(time_c)=1374
3 件のコメント
Rik
2018 年 2 月 19 日
If the result of one iteration depends on the previous, no. If it doesn't you can simply change at what index the loop start. Without the complete code it is impossible to say which is the case, although it looks like there is a dependency.
sairohith mudduluru
2018 年 2 月 19 日
Walter Roberson
2018 年 2 月 19 日
If you need to debug 576 then use the conditional breakpoint method.
採用された回答
その他の回答 (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!