|
-
February 8th, 2008, 01:33 AM
#1
calling Matlab from c++ program
Hi,
Can anyone of u help me to call Matlab functions from c++ program.
I need to write a c++ program and from this, i need to carry out a few calculations and need to plot the graphs. I have Matlab Component Runtime. Will it enough? or need any other to do the above things.
Thanks in advance...........
-
February 18th, 2008, 07:12 PM
#2
Re: calling Matlab from c++ program
You'll need to use the Matlab add in for visual studio. Here is an example:
http://www.codeproject.com/KB/macros...ab_add_in.aspx
And here is the Mathworks' instructions for setting up the Matlab add-in.
http://www.mathworks.com/support/sol...lution=1-18L04
-
February 19th, 2008, 12:50 AM
#3
Re: calling Matlab from c++ program
If you have the C files spat out by the Matlab compiler, the Matlab Component Runtime will be good enough. If you don't, you'll need the full version of Matlab, in order to use the Matlab Engine.
Note that one way is not really faster than the other. The Matlab Compiler doesn't actually generate native-C libraries....it merely wraps up all the Matlab access calls in a convenient interface. Everything will still run as slowly as it would in Matlab itself. The only real difference between using compiled code with the MCR vs the Matlab Engine is that the Engine gives you a command-line interface which you can use similarly to the Matlab GUI while it's active.
Of course, another option is to write C files which may be called from Matlab. I don't have much experience with that; however, the first thing you need to decide is which language will be the "host" and which will be the "guest".
I took a look at the above VC++ add-in. It appears to simply be some convenience stuff using the Matlab Compiler + MCR approach. You can do the same thing without it if you have trouble.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|