Calling Matlab in C in Matlab

Hi everybody!

My problem can be described as follows.
I have a tool in Matlab that requires calling an optimisation
algorithm in C. This algorithm consists of several C-files, one of
which contains the function to be minimised (CFUNCTION), and another
is the main algorithm file (CMAIN).

Now what I want to do is to call Matlab from CFUNCTION or CMAIN and
specify my custom function (MFUNCTION) to be minimised.

So, I'm calling Matlab from C from Matlab.

I'm a newbie in C and MEX files. Should I rewrite CMAIN as a MEX file
and include CFUNCTION in this and then use mxCallMATLAB? Or can I
rewrite CFUNCTION to call Matlab and still call CMAIN from Matlab?

I also need to pass arguments between all of these functions and
files. Any tip on this?

Any help would be greatly appreciated.
Many thanks in advance!
12399 (1)
12/16/2005 2:21:33 PM
comp.soft-sys.matlab 211264 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

0 Replies

Similar Articles

[PageSpeed] 9