Mex to S-function

1 Ansicht (letzte 30 Tage)
Audrow Nash
Audrow Nash am 18 Jul. 2017
Kommentiert: Audrow Nash am 21 Jul. 2017
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.

Antworten (1)

Saurabh Gupta
Saurabh Gupta am 21 Jul. 2017
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 Kommentar
Audrow Nash
Audrow Nash am 21 Jul. 2017
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?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by