S Function Builder - To implement existing C code

조회 수: 1 (최근 30일)
Ravikiran Nagaraja
Ravikiran Nagaraja 2018년 10월 9일
댓글: Ravikiran Nagaraja 2018년 10월 16일
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.

채택된 답변

Sean de Wolski
Sean de Wolski 2018년 10월 9일
  댓글 수: 2
Titus Edelhofer
Titus Edelhofer 2018년 10월 9일
Good point. I've used it last week and it's simple to use!
Ravikiran Nagaraja
Ravikiran Nagaraja 2018년 10월 16일
I am using 2013b version. Is the C Caller block availabe for this version?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Titus Edelhofer
Titus Edelhofer 2018년 10월 9일
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

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by