How can I implement conditional compilation logic in simulink and stateflow?

18 ビュー (過去 30 日間)
matlab kid
matlab kid 2012 年 10 月 17 日
回答済み: Yashapal Chaudhary 2018 年 2 月 2 日
Is there any way to implement conditional compilation in simulink and stateflow. Example: #if (condition) {do something} #else {do something else} #end Iam From Automotive embedded systems background. Conditional compilation is very much required for Embedded systems software developement. I cannot find any block that support use of compiler directives in simulink. Can anyone help?
  1 件のコメント
Yashapal Chaudhary
Yashapal Chaudhary 2018 年 2 月 2 日
you can use variant subsystem for creating pre processor directive

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

回答 (4 件)

Siddharth
Siddharth 2012 年 10 月 17 日
In Stateflow, you build state machines using a graphical or (new) state transition table interface and conditional logic using flow charts. Find more information about flow charts here: www.mathworks.com/help/stateflow/decision-logic.html
The pattern wizard (user interface window) can be used to quickly build commonly used patterns like the ones you are asking about: http://www.mathworks.com/help/stateflow/ug/creating-flow-graphs-with-the-pattern-wizard.html
hope that helps, Siddharth

Guy Rouleau
Guy Rouleau 2012 年 10 月 18 日

K E
K E 2012 年 10 月 18 日
Simulink allows Conditional Subsystems which are block groups that are executed if chosen conditions are met. More info in this blog post. I am not sure how to incorporate compiler directives as your question states, but maybe all you want to do is to execute some parts of the model conditionally, which can be done with Conditional Subsystems.

Yashapal Chaudhary
Yashapal Chaudhary 2018 年 2 月 2 日
you can use variant subsystem for creating pre processor directive

カテゴリ

Help Center および File ExchangeComplex Logic についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by