フィルターのクリア

cleaning functions in MEX files

5 ビュー (過去 30 日間)
Cédric Devivier
Cédric Devivier 2011 年 9 月 3 日
Dear all,
I have some issues with MATLAB cleaning functions in MEX files. In the link below is a zip file containing the c++ code, some data to test it and a m file to build it and run it.
I was able to compile it under linux before but from a system upgrade it won't anymore. I narrowed the problem down to the cleaning part when returning to windows but my knowledge in c++ stops here. I didn't wrote the code myself (I adapted it for matlab and the large arrays dim).
Thank you for your help,
Cédric
  2 件のコメント
Olaf
Olaf 2011 年 10 月 19 日
Hi Cédric,
Have you solved the problem already? If not, can you provide an example you would call mf2 from the Matlab prompt? What exactly did you mean by the "cleaning part"?
Olaf
Cédric Devivier
Cédric Devivier 2011 年 10 月 20 日
Hi Olaf,
I have not solved this issue yet.
If you download and unzip the mf2.zip file, open the compile.m file in the mf2 folder newly created.
You will see issues if not after the first run, run again 'cutsideg = mf2(sourcesinkg,remaing);' a couple of times.
"The cleaning part" means when the mex file is exiting and returning to MATLAB. I used valgrind and gdb and it didn't find any errors, but when I run the same mexa64 compiled file, it crashes.
Thanks for your help,
Cédric

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

採用された回答

Cédric Devivier
Cédric Devivier 2012 年 9 月 7 日
編集済み: Cédric Devivier 2012 年 9 月 7 日
This problem has been solved in the comments of this file:

その他の回答 (1 件)

Jan
Jan 2011 年 10 月 19 日
This will fail if the input is a DOUBLE array:
float *sourcesinkVal;
sourcesinkVal = (float *) mxGetPr(prhs[0]);
Better use:
float *sourcesinkVal;
if (!mxIsSingle(prhs[0])) {
mexErrMsgTxt("1st input must be a SINGLE.");
}
sourcesinkVal = (float *) mxGetData(prhs[0]);
It is not clear where the function crashs. Please post more details.
  1 件のコメント
Cédric Devivier
Cédric Devivier 2011 年 10 月 20 日
Hi Jan,
Thanks for your remark, I added the same for the second input.
As I said to Olaf, MATLAB crashes when I run it. And from the crash dump, the begining looks like:
Abnormal termination:
Abort signal
In my understanding, this routine does not clean properly the variables it created. Also sometimes, I have an error like that:
"glibc detected *** corrupted double-linked list"
Thanks for your help,
Cédric

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by