필터 지우기
필터 지우기

how to link c code to simulink

조회 수: 1 (최근 30일)
sneha bharadwaj
sneha bharadwaj 2017년 1월 23일
댓글: sneha bharadwaj 2017년 1월 30일
I have a c code i need to call the functions in the c code using s function in simulink... please someone give me the detailed procedure..

채택된 답변

Easwar Kumar Yarrabikki
Easwar Kumar Yarrabikki 2017년 1월 23일
  • First create an S-function for the C-Code that you have. if you haven't deal with S-functions yet, Basic C MEX S-function will be a good start.
  • Once you have your C Mex S-function ready, Then Convert your .C file into a MEX file by typing MEX myfilename.C in your work space(Assuming filename as myfilename).
  • Then grab S-function block from your user-defined functions library in Simulink into your model. When you double click on the block it will ask you for the S-function file name and parameters that you want to pass on. In file name field give your s-function name, in this case myfilename.
  댓글 수: 3
Easwar Kumar Yarrabikki
Easwar Kumar Yarrabikki 2017년 1월 25일
편집: Easwar Kumar Yarrabikki 2017년 1월 25일
Sneha have ever worked with mcc (MATLAB Compiler). In the above answer I suggested you to use MEX command to compile .C files. So if you really want to target a particular library (in your case .dll) you can do that from mcc command. if you need details on mcc check this link
sneha bharadwaj
sneha bharadwaj 2017년 1월 30일
ok thank you very much Easwar Kumar Yarrabikki

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by