Embedding MATLAB

Hello all,

is there a way to use MATLAB libraries from C/C++ code?

I mean not using MATLAB API to interpret MATLAB code, but rather directly calling function MATLAB itself uses (e.g. matrix multiplication) and working with the data structures MATLAB itself uses.

Any help would be appreciated.

Thanks in advance!

Reply to
Yuri Feldman
Loading thread data ...

I've only ever heard of Matlab being used as a back end when running as a complete program. I suspect direct access access to its internals in the manner you evisage is impossible, or at least nightmarishly complex.

The GPL'ed Octave package is fairly Matlab compatible and you may have some luck unravelling that since at least you have the source code to play with, but ISTR it is a fairly hefty app and you'll probably need to set aside at least a couple of days to become familiar with the source.

Things like matrix operations are fairly generic though. Have a look around for mathematical libraries - you should be able to find something to fit your requirements with a lot less aggro than paring down a fully fledged package to what you actually need.

--
Andrew Smallshaw
andrews@sdf.lonestar.org
Reply to
Andrew Smallshaw

You mean LINPACK, LAPACK, etc.?

--
	mac the naïf
Reply to
Alex Colvin

yes, you need to buy the code generator

Reply to
steve

Don't know what your budget is, but this is one way to do it:

formatting link

Bob Stephens

Reply to
Bob

Did you look at S- Functions in MATLAB? I would sugget you to go through it. You can generate a DLL from M-File S-Functions.

Reply to
dk

If you are trying to call Matlab on a desktop from a C program you can use the Matlab Engine to do so.

If you want to include Matlab functions in generated code for compiling and embedding in an application, you would need to use the Matlab compiler.

The first option is "free". The second requires you to buy the compiler which is a separate library. (assuming you would have the rest of the tools necessary to generate C code from Matlab).

JW

Reply to
jw

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.