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

10 visualizaciones (últimos 30 días)
Charles Wang
Charles Wang el 14 de Oct. de 2011
Comentada: Manjunath Bhimalli el 14 de En. de 2019
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!

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 14 de Oct. de 2011
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 comentarios
Fangjun Jiang
Fangjun Jiang el 1 de Nov. de 2011
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 el 14 de En. de 2019
Try with connecting Unit Delay(1/z) block and take the feedback.

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by