How to call a MATlab function from VC++?

Dec 12, 2016 at 1:46am
Hi,

I have written my main code in VC++ and I want to call a MATlab function from this VC++ code. Does anybody know how to do that?

I don't want to rewrite my MATlab code into C++.
Dec 12, 2016 at 2:45am
I am not very familiar with the matter, but have you tried #include?
Dec 12, 2016 at 5:29am
Dec 12, 2016 at 7:32am
@edge6768, Thank you for your response. Would you please be more specific? Because I am trying to do that but I don't know how to call a MATlab user-defined function into VC++ environment?
Dec 12, 2016 at 7:02pm
The first link I provided follows an example downloaded with MATlab. According to that, it can be found here:
The program engdemo.c, in the matlabroot/extern/examples/eng_mat folder, illustrates how to call the engine functions from a standalone C program. For the Microsoft® Windows® version of this program, see engwindemo.c.

Obviously, you will need to see engwindemo.c since you're on Windows.

The second link details the functions provided in engine.h.

It looks like you will need to #include "<full file path>/engine.h" then create an Engine object which acts like a MATlab interpreter. You then use the functions from the second link to send it commands.
Topic archived. No new replies allowed.