How to define variable size parameter in s-function

4 次查看(过去 30 天)
Dear Matlab experts,
I'm generating a s-function with tunable Parameters in Matlab Simulink 2012b 32bit. The parameter is a matrix e.g. A=zeros(2,11). In this s-function only one specific line of this matrix will be used with the row selector for futher calculation.
Now I want to use the same s-function with the new parameter A=zeros(20,11). An error Pops up :" Parameter 'A' has to be a [2x11] Array."
How can I define this tunable Parameter to be with variable size, maybe with a maximum size of 20x11, for the Code Generator?
Thank you for your support

回答(1 个)

Nick Choi
Nick Choi 2017-10-3
Something to look into would be run-time parameters. The following documentation page provides useful information regarding how to utilize them in S-functions: http://www.mathworks.com/help/simulink/run-time-parameters.html
Additionally, you can execute the following command at the MATLAB command prompt to open example models that contain S-functions that utilize run-time parameters:
>> sfcndemo_runtime

类别

Help CenterFile Exchange 中查找有关 Block and Blockset Authoring 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by