How to show simulink output based on a previous output?

조회 수: 4 (최근 30일)
Munim Hussain
Munim Hussain 2020년 12월 16일
답변: Shlok 2024년 10월 17일
I want to make an output in simulink, depending on a previous output. If the previous output from a block is -ve, I wanna show an output naming 'Lagging' and if the output from the same block is +ve, I wanna show an output naming 'Leading'. How I can do that?

답변 (1개)

Shlok
Shlok 2024년 10월 17일
Hi Munim,
To generate the output based on the previous block's output, I suggest you using a “Switch” block. The “Switch” block allows you to route one of two inputs to the output based on a specified condition. To set it up, follow the following steps:
  • Supply the output of the previous block to the comparator input of the Switch block.
  • Set the “Leading” option for the first input and the “Lagging” option for the third input using a String Constant block.
  • Then, configure the comparator condition to >= 0.
This model will resemble the following image:
Alternatively, you can also use a MATLAB Functionblock. This allows you to write custom MATLAB code to compare the input and produce the desired string output.
To know more about the blocks mentioned above, refer to the following documentation links:
Hope this helps.

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by