Different outputs for mex library and c library

4 Ansichten (letzte 30 Tage)
Octav Chipara
Octav Chipara am 14 Aug. 2012
Hi,
I got into a weird situation with the coder: i have converted a matlab function to a mex function and verified that their outputs match. However, when I use the same code base to generate a static c library that is not the case anymore. Any ideas of how I may go about debugging this. I'd gladly share the files, though I do not not have a minimalistic test case.
-- Octav
  2 Kommentare
Friedrich
Friedrich am 14 Aug. 2012
Maybe put some printf in your code at specific points. Then compare the printed results from the mex with the one of the library. In this way you can narrow down the problem to a specific area in your code. Afterwards you have to dig into it by using your brain excessively.
As far as I know the mex target generates more or less the same C code as the library target. It only adds a wrapper for converting the data types to mxArrays and back.
The best is to share an example (if too complicated). If its too complicated and long consider contacting MW Technnical Support.
Kaustubha Govind
Kaustubha Govind am 14 Aug. 2012
The one difference between the MEX target and DLL target that I can think of is that functions unsupported for code-generation will not generate any code for the DLL target (in the case of a MEX target, it simply dispatches the call to the MATLAB Engine). Examine your code for any functions declared using eml.extrinsic/coder.extrinsic.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by