Mex to S-function

조회 수: 1 (최근 30일)
Audrow Nash
Audrow Nash 2017년 7월 18일
댓글: Audrow Nash 2017년 7월 21일
I am building a binary from C++ code using Mex. I want to use this binary in Simulink—without calling it externally.
How can I use an S-function for this? Note, I use external libraries and several source files. Ideally, I could use the same line of code to compile Mex from Matlab as Simulink.

답변 (1개)

Saurabh Gupta
Saurabh Gupta 2017년 7월 21일
You can create an S-function block from your C++ code using the Legacy Code tool.
Alternatively, if you are only looking to call it as a function for some computation and use the results in Simulink, you could use MATLAB Function block to call it in MATLAB code and use it in Simulink. The following links should be helpful.
  댓글 수: 1
Audrow Nash
Audrow Nash 2017년 7월 21일
How do I pass a Matlab vector as an argument and return value?
I am doing this in the C++ code with Mex with mxArray. Can I do the same thing with the Legacy code tool?

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by