Borrar filtros
Borrar filtros

cleaning functions in MEX files

5 visualizaciones (últimos 30 días)
Cédric Devivier
Cédric Devivier el 3 de Sept. de 2011
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 comentarios
Olaf
Olaf el 19 de Oct. de 2011
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 el 20 de Oct. de 2011
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

Iniciar sesión para comentar.

Respuesta aceptada

Cédric Devivier
Cédric Devivier el 7 de Sept. de 2012
Editada: Cédric Devivier el 7 de Sept. de 2012
This problem has been solved in the comments of this file:

Más respuestas (1)

Jan
Jan el 19 de Oct. de 2011
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 comentario
Cédric Devivier
Cédric Devivier el 20 de Oct. de 2011
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

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB Compiler en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by