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!
Didn't find your answer? Ask the community — no account required.
A
Andrew Smallshaw
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
A
Alex Colvin
You mean LINPACK, LAPACK, etc.?
mac the naïf
S
steve
yes, you need to buy the code generator
B
Bob
Don't know what your budget is, but this is one way to do it:
formatting link
Bob Stephens
D
dk
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.
J
jw
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
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.