How can I break a WHILE or a FOR loop in Simulink?
7 ビュー (過去 30 日間)
古いコメントを表示
I want to break a for loop or a while loop in Simulink. For instance, we have break statement in C. How do I do the same in Simulink?
0 件のコメント
回答 (1 件)
Abhiram
2025 年 1 月 29 日
Hi Snehal,
To achieve break functionality within 'while' loops in Simulink, the 'While Iterator' block can be utilized in conjunction with other blocks to replicate the effect of a 'break' statement. Refer to the following thread for an implementation example:
Regarding 'for' loops, Simulink does not inherently support breaking out of a ‘for’ loop using the 'For Iterator' block. However, a workaround can be implemented as detailed in the provided thread:
Refer to Simulink Documentation for more information about ‘While Iterator’ and ‘For Iterator’ blocks.
0 件のコメント
参考
カテゴリ
Help Center および 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!