How can I put conditional setting (if/else) on switch case block in Simulink?

2 views (last 30 days)
I want to put two conditions, for case 1 and case 2, for example:
case 1 - if u1 >=20
case 2 - elseif u1 <= 20
How can I do this if the switch case block only accept scalar?

Answers (1)

Paul
Paul on 4 Feb 2023
Hi Gabryella,
Please clarify the question. This logic:
case 1 - if u1 >=20
case 2 - elseif u1 <= 20
works when u1 is a scalar, but won't work in the Switch Case because that only checks for equality of integers using ismember-like logic.
Maybe you want to use the If and If Action Subsystem blocks, which are a bit more flexible.

Categories

Find more on Event Functions in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!