Generating S-Function gives ERROR with Variable Size Signal
2 views (last 30 days)
Show older comments
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:
- Setting Model Referencing > Propagate sizes of Variable-size signal to During Execution.
- 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.
0 Comments
Answers (1)
Salini S Nair
on 6 Oct 2021
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 Comments
Agam Srivastava
on 7 Oct 2021
Edited: Agam Srivastava
on 7 Oct 2021
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:
- Setting Model Referencing > Propagate sizes of Variable-size signal to During Execution.
- Selecting Variable Size Signals in Code Generation > Interface
Salini S Nair
on 8 Oct 2021
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.
See Also
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!