How to stop if else condition after it executes only once.

1 ビュー (過去 30 日間)
RUPESH TATTE
RUPESH TATTE 2021 年 6 月 26 日
編集済み: Jonas 2021 年 6 月 27 日
I have created a simulink block to execute if else condition. But, I need to stop this condition after it exucute once. How to do it?
  3 件のコメント
Soniya Jain
Soniya Jain 2021 年 6 月 27 日
I am not sure but you can try to use "persistent" variable in your code, persistent means that the variable will still remember its value the next time the function is called. Refer a MATLAB Answer https://www.mathworks.com/matlabcentral/answers/113017-only-check-if-statement-once-or-disable-code-block-after-1-check

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

回答 (1 件)

Jonas
Jonas 2021 年 6 月 27 日
編集済み: Jonas 2021 年 6 月 27 日
Put your blocks inside an enabled subsystem, and use the outputs of your if-else block to disable the subsystem itself.

カテゴリ

Find more on Subsystems in Help Center and File Exchange

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by