How to convert block parameters into input ports in Simulink

Hi, I would like to know if there is any way to convert block parameters into input ports? For example I have a Multi-Port Switch and I would like to enter the "Number of data ports" as an input:
I know we can control this parameter through Matlab workspace, but I'm wondering if there is any way to control through an input.
Thanks, --Kash

답변 (2개)

David Ding
David Ding 2017년 5월 25일
Hi Khashayar,
It depends on the blocks you are working with. For example, in your case of a Multiport Switch, this is possible. Simply connect the first inport with a constant block. The value of the constant block will determine the number of inputs for the Multiport Switch. The value of the Constant block can be extracted as follows:
str2double(get_param('testModel/Constant', 'Value'))
I am attaching the screenshot "testModel.png" for your reference.
Thanks,
David

댓글 수: 1

David,
Is there a way to convert block parameters - Integrator High limit and Low limit - into the input signals to the Integrator block?
Appreciate your response.
Thank you,
Arshad S.

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

Khashayar Olia
Khashayar Olia 2017년 5월 25일

0 개 추천

Hi David, You're right, it depends on the block. I'm using embedded coder for TI c2000 microcontrollers and would like being able to change the Message identifier and Message type dynamically while the software is running:
I guess the only way to control these two parameters dynamically is to define two inputs so I would be able to feed them with desired values. But I think it's impossible in Simulink.
--Kash

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

질문:

2017년 5월 22일

댓글:

2022년 2월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by