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!