S Function Builder - To implement existing C code
1 view (last 30 days)
Show older comments
Ravikiran Nagaraja on 9 Oct 2018
Commented: Ravikiran Nagaraja on 16 Oct 2018
I am working on Simulink, S-Function Builder Block. I have a query about that, to explain in brief.
I have a working C code, I have to implement this C code somehow in S-Function Builder block so that the code uses the real-time values from inputs and gives the necessary output according to the action of C code.
My question is where exactly to implement this C code ??
I hope you understand my question, please give me the possible solution.
Sean de Wolski on 9 Oct 2018
If you're using 18b, consider using the C Caller block:
More Answers (1)
Titus Edelhofer on 9 Oct 2018
usually (as long as your working C code has no states) you simply put it into the "outputs" function of the S-function builder. Something like
y0 = yourWorkingCode(u0, u1);
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!