How to set flags in Simulink?

12 visualizzazioni (ultimi 30 giorni)
Pallanti Srinivasa Rao
Pallanti Srinivasa Rao il 12 Nov 2017
Risposto: Yogananda Jeppu il 13 Nov 2017
Hi, I have to implement the following Matlab code in Simulink. To implement if-else conditions, I have used switch block. I am facing the problem in setting flags.
flag = 0; if a > 0 { c = a + b; flag = 1; } else { c = a - b; if flag == 1; { c = 0; } flag = 0; } end
Thanks

Risposte (1)

Yogananda Jeppu
Yogananda Jeppu il 13 Nov 2017
Is the problem correct? How can flag be 1 in the else condition? Can you provide the matlab code with proper indentations. Try and use the Matlab function block if the idea is to do something quick.

Categorie

Scopri di più su Simulink Functions in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by