Simulink variable number of input to a block

조회 수: 14 (최근 30일)
Nicolas B.
Nicolas B. 2019년 7월 17일
댓글: Sami 2023년 1월 25일
Hello,
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?
Regards
Nicolas
Unbenannt.PNG
  댓글 수: 1
Sami
Sami 2023년 1월 25일
Hello Nicolas. I am having a same issue. I need to create a block with configurable number of inputs.
Could you please share a simple example of how such a block can be made?
Bes regards
Sami Tabbakh

댓글을 달려면 로그인하십시오.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2019년 7월 17일
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
Nicolas B.
Nicolas B. 2019년 7월 18일
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:

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by