S-Function creation for Target link generated code

61 次查看(过去 30 天)
Hello Team,
I am creating on S-Function creation for Target Link generated codes.
I tried Legacy tool, but Legacy tool works well only when the input parameters and the return type are properly defined.
Example: When i have a function like==> double Sum( double a, double b).
Using def.OutputFcnSpec = 'double y1 = doubleIt(double u1, double u2)'.
But Target Link generated code, the main function is Void.
Example: The function looks like this, Void Sum(Void), in Sum.c file.
Facing difficulty in creating S-Function for this.
Can you please suggest any work around for the above issue.
Regards
Santhosh A

回答(1 个)

Sahas
Sahas 2024-8-20,10:14
As per my understanding of the question, you would like a way to generate “S-function” using “legacy tool” for a function whose “return” and “argument” parameters are of “void” type.
I was able to create a small example for this, please follow the steps below to create the “S-function” with required specifications:
  • Create two code files named "sum.c" and "sum.h" that contain a void function and the headers, respectively.
  • Generate the S-function using “legacy code tool”.
  • A Simulink model will open with the required “void” type block.
To know more about using the “legacy code tool”, it’s integration with C/C++ code and a few examples, refer to the following documentation links:
I hope this is beneficial!

Community Treasure Hunt

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

Start Hunting!

Translated by