Convert a MEX-function to an S-function
Mostra commenti meno recenti
Dear all,
I want to implement an opensource nonlinear solver in Simulink such that it is suitable for code-generation (XPC-target). For this I want to convert an existing .mex file into an S-function.
Some background info:
I am using the IPOPT nonlinear solver which is supplied with the OptiToolbox (opensource) compliled as a precompiled .mex file which works perfectly under Matlab. However, to be able to use the solver in XPC-target I need to create and S-function block in Simulink.
Other options I've tried so far:
- Since I already have a mex-file I thought it would be convenient to use that inside a simple 'Matlab Function'-block. This works in Simulink, but the code generator cannot compile the Simulink diagram to a real-time executable code.
- Creating an S-function in which I call the .mex function. This code cannot be compiled since the .tlc file is missing.
Question
After some search on fora and Matlab central, I found out that I should create a C MEX S-function and compile it. To make life easier, Simulink comes with an S-function builder in which libraries, headers etc. can be added. I failed in constructing one and it is driving me crazy.
I think it would be easiest to convert the .mex function into an S-function (if possible). My question to you therefor is:
Who has experience in converting an .mex function (based on a large set of C++ routines) into an S-function in Simulink
Your help will be greatly appreciated!
1 Commento
Erivelton Gualter
il 23 Feb 2018
Hello Martijn,
Did you have any success with this issue?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Simulink Coder in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!