Generating S-Function gives ERROR with Variable Size Signal

2 次查看(过去 30 天)
I am trying to generate S-function for my model and it is failing with ERROR as Support for Variable Size Signal is Turned Off.
However, I dont see the option to enable that Option for generating S-function. I have already tried the following:
  1. Setting Model Referencing > Propagate sizes of Variable-size signal to During Execution.
  2. Selecting Variable Size Signals in Code Generation > Interface
I am not sure how I can enable Support for Variable Size signal for Generating S-function.
Attached is the screenshot of the Issue.

回答(1 个)

Salini S Nair
Salini S Nair 2021-10-6
I understand that you are getting an error while generating S-function which uses variable-size signal.
The examples given in the following link demonstrate how the S-function blocks can be enabled to propagate variable-size signal:
The following documentation provides details on the properties of the S-function block that need to be varied to allow the use of variable-size signals:
In addition, refer to the following documentation for details on how variable-size signals are handled in Simulink and which blocks in Simulink support them:
  2 个评论
Agam Srivastava
Agam Srivastava 2021-10-7
编辑:Agam Srivastava 2021-10-7
Thanks for your reply.
Actually I am trying to do the vice versa of it, that is, my simulink model is using variable sized signal for some computation (Find Non-Zero Elements Simulink Block) but output after this computation is not variable sized.
Now if I try to create S-function of this simulink model for running SIL, I get this issue that Variable Size signal is disabled in Code Generation Interface. But I dont see the option to enable the same.
Attached is the screenshot of how I am trying to create this S-function and the issue that I am getting.
I have already tried the following:
  1. Setting Model Referencing > Propagate sizes of Variable-size signal to During Execution.
  2. Selecting Variable Size Signals in Code Generation > Interface
Salini S Nair
Salini S Nair 2021-10-8
You can try setting the Variable-size signal attribute of the Outport to Yes and see if it resolves the issue. This can be done by right clicking on the block (Outport) and accessing Block properties > Signal Attributes > Variable-size signal: Yes.
Variable size signals are generally supported in S-functions but also depend on the actual block implementation. It would be helpful if you could share the model or the detailed workflow. It will help in getting more insights.
In addition, please feel free to contact technical support by creating a service request so that we can assist you in resolving your issue.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by