Different outputs for mex library and c library

4 ビュー (過去 30 日間)
Octav Chipara
Octav Chipara 2012 年 8 月 14 日
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 件のコメント
Friedrich
Friedrich 2012 年 8 月 14 日
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 2012 年 8 月 14 日
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.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Coder についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by