MATLAB Answers

Simulink variable number of input to a block

30 views (last 30 days)
Nicolas B.
Nicolas B. on 17 Jul 2019
Commented: Nicolas B. on 18 Jul 2019
For a few of my self-developed blocks in Simulink, I would like to have a variable similarly to the "Product" block (see below).
I was trying to use a callback function which adds or deletes inputs programmatically. However, this method is not very practical if you want to have a library because you have to break the link to the library in order to change the number of inputs.
Is there a better solution to perform that?


Sign in to comment.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 17 Jul 2019
It could be done.
First, understand this
Second, construct your model with many Terminator blocks.
Last, run replace_block() in your callback based on your parameter, replace Terninator block with Inport block.

  1 Comment

Nicolas B.
Nicolas B. on 18 Jul 2019
Thank you for your answer. It's exactly what I'm looking for.
Unfortunately, the link is not working (but easy to find with search engine). So I just put a copy here for other persons:

Sign in to comment.

More Answers (0)

Sign in to answer this question.