How to define variable size parameter in s-function

4 Ansichten (letzte 30 Tage)
Stefan Wahlig
Stefan Wahlig am 29 Sep. 2017
Beantwortet: Nick Choi am 3 Okt. 2017
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

Antworten (1)

Nick Choi
Nick Choi am 3 Okt. 2017
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

Community Treasure Hunt

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

Start Hunting!

Translated by