MATLAB Answers

Using compile version of program including a C/mex function

1 view (last 30 days)
Morgan
Morgan on 25 Feb 2013
Hi,
THE PROBLEM
I have a main program that run an optimization function. The cost function is calculated thanks to a C external function for speed. I have compiled the C function without any problem and created a mex functions from it. The main program using the mex function works without any problem.
I want to deploy this program on other machines which do not need Matlab installed. When I run the deployed program it crashes systematically in one function. The error message is:
(ERROR) Output argument "f" (and maybe others) not assigned during call to "MATLAB\InverseKinematics\distrib\InverseKinematics_mcr\MatlabDev\Tools\Optimization\autoGradGOM2C.m (autoGradGOM2C)".
The function autoGradGOM2C.m which crashes is a function where the mex function is evaluated to calculate the gradient.
WHAT I TRIED
I thought that maybe the mex function was not well linked so I called it from somewhere else within the main program. It gave me the results I was expecting without any problem.
The error message is strange, it tells me that the function autogradGOM2C do not return any results. I modified it so that whatever happen the results variables are set before doing anything. Still the same crash.
I am running out of ideas now.
Thanks for your help,
  1 Comment
Walter Roberson
Walter Roberson on 25 Feb 2013
Does your code happen to be of the form (e.g.)
ode45('MexFunctionName', ...)
that is, being referenced by string content? If so then did you add a %#function pragma ?

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!