MATLAB Answers

S Function Builder - To implement existing C code

Hello,
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.

  댓글 수: 0

로그인 to comment.

제품


릴리스

R2013b

답변 수: 2

Sean de Wolski 님의 답변 9 Oct 2018
 채택된 답변

  댓글 수: 2

Good point. I've used it last week and it's simple to use!
I am using 2013b version. Is the C Caller block availabe for this version?

로그인 to comment.


Titus Edelhofer 님의 답변 9 Oct 2018

Hi Ravikiran,
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[0] = yourWorkingCode(u0[0], u1[0]);
Titus

  댓글 수: 0

로그인 to comment.



Translated by