How to implement this c-code: if(Flag == 1) {Flag = 0;} ?

9 ビュー (過去 30 日間)
Charles Wang
Charles Wang 2011 年 10 月 14 日
コメント済み: Manjunath Bhimalli 2019 年 1 月 14 日
I used a signal (this is what I needed) for Flag at an input port of stateflow, but Flag is not recognized inside the stateflow. If I add an input data in the stateflow, it will not be allowed to change the value (through a transit with a statement {Flag=0;} inside the stateflow).
Please help. Thanks!

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2011 年 10 月 14 日
This is one of the difference between C and Simulink. In C, you can re-use the variable name. In Simulink, the signal name represents the data flow. You can't re-use the signal name. You have to declare an output for the Stateflow and then assign value accordingly.
  12 件のコメント
Fangjun Jiang
Fangjun Jiang 2011 年 11 月 1 日
You are right. Port name is used to identify the port block. The generated code will not necessarily use port name for variable name.
Manjunath Bhimalli
Manjunath Bhimalli 2019 年 1 月 14 日
Try with connecting Unit Delay(1/z) block and take the feedback.

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

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by