Filter löschen
Filter löschen

How to create a variant sink condition depending on the input

3 Ansichten (letzte 30 Tage)
I would like for my Simulink signal to follow one route if it is negative, and another if it is positive. I am using a variant sink block in order to achieve this, but how can I make it dependent on the input rather than a predefined value in the workspace? I have tried using a To Workspace block, but this only creates the value after the simulation, meaning it can't be used in the variant sink. The input is coming from a step block that is manually changed depending on the desired simulation. Thanks in advance.

Akzeptierte Antwort

Gillian Rosen
Gillian Rosen am 14 Mär. 2017
Hi Emily, 
I understand that you would like to find a variant sink block that changes condition depending on a signal input, instead of a workspace variable. 
One option that could work for you is to use a Manual Variant Sink block. You mentioned that you are manually changing the input to the Variant Sink depending on the desired simulation; with a Manual Variant Sink, you could manually change the path at this time as well. See the documentation for this block for more information: 
Another option for you could be to use a Switch block instead of a Variant Sink. With this method, you would connect your Step input to both paths, and at the end of the paths, place a Switch block that determines which path to follow. The control input for the Switch block can be some property of your Step input. See the documentation for examples and more information: 
  1 Kommentar
Bicheng Guo
Bicheng Guo am 13 Dez. 2018
Hi, I have the same problem.
I have a s-function and it has 6 outputs, the next step is to determing is there a negtive in 6 outputs. If there is one negtive, the simulation should be stop. In this case, I choose a variant sink, one of the output connects to stop block and another connects to next s-functino to continue simulating. The thing is how can I use variant sink depending on its input?
I don`t choose a switch because it has only one output so i can`t connect it to two direction.
Thank you very much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by