I am running into a simular problem as described above. I am looking for more specific information on how to construct an S-function from a large collection of C++ routines, headers etc.
I need to implement a nonlinear solver as a Simulink S-function such that it is code-generation for XPC-target and Windows-target code-generation is possible. I am using the IPOPT solver (<http://www.coin-or.org/download/source/Ipopt/)>, which consist of a large set of C++ routines, headers etc.
This is what I've tried so far: • Since I already have a mex-file (OptiToolbox Opensource) I thought it would be convienent 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.
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 etc. can be added. However, I failed in constructing one and it is driving me crazy.
Who has experience in using a nonlinear solver as an S-function in Simulink?