calling matlab m-file from mex


alsheets
10-16-2008, 11:44 AM
I was wondering if there was an nr3 function that calls matlab m-files from within the compiled mex file. I know that the mexCallMATLAB command would work, but I was hoping there was a command that would allow me to pass m-file names in to the functions defined by the nr3 book.

For example simplex algorithm (p.502-7) inputs are:
VecDoub minimize(MatDoub_I &pp, T &func)

When calling this function I pass:
pmin=am.minimize(p,func)

So far I haven't been able to determine the correct syntax for passing the matlab m-file name. Any help would be greatly appreciated.
Thanks for your time,
Alison

William Handler
11-21-2008, 01:02 PM
Have a look at my functor in the numerical integration code I posted. It does what you are asking about.

i.e. In the matlab space you have a function you want to call from within your c code

I do it because my c code integrates functions that are defined in matlab.

Will Handler