Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Passing different data type between various mex functions from within matlab

1 visualización (últimos 30 días)
Suppose I want to pass a pointer to different data type to pass between various functions in Matlab, can I do it?
For e.g: Suppose the library in C I use two structure pointers "ghkModel* m" and "ghkData* d". These are library specific data types. These are two large structures that contains various fields. I need to preserve the content of ghkData *d since it is used later by varous functions.
Is there a way to do this:
For example, this is what I want to do:
myMatlabFunction()
[m, d] = C_mex_funtion_1(); % m and d contains the structure ghkModel and ghkData
[p, q] = C_mex_function_2(m,d);
rslt = C_mex_function_3(p,q, m,d);
end
Basically question is how to pass in data that is not of type mxArray to other mex functions within matlab code?
And how to allocate memory to it? I mean in the mex entry point.
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
ghkModel* m = mxGetPr(prhs[0]);
ghkData* d = mxGetPr(prhs[1]);
callSomeFunction(m,d);
}
Any helpful suggestion is appreciated.
  1 comentario
James Tursa
James Tursa el 3 de Jun. de 2016
Are the mex functions written by you? I.e., do you have the source code for them and can modify them?

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by