Passing containers.Map to MEX file

How do you pass a containers.Map object to a MEX file? How do you access the data from inside the MEX file?

 Respuesta aceptada

Titus Edelhofer
Titus Edelhofer el 13 de Mayo de 2011
Hi,
passing the variable is easy: just use it ;-). O.K., serious now. Passing is not the problem but doing anything meaningful will be. You will be able to call methods using mexCallMATLAB, e.g.,
/* cmap.c */
void mexFunction(int nlhs, mxArray* plhs[],
int nrhs, const mxArray* prhs[]) {
mexCallMATLAB(1, plhs, 2, prhs, "isKey");
}
and in MATLAB:
x = containers.Map('foo', 42);
v = cmap(x, 'foo');
Otherwise: pass x.keys and x.values to mex function and work with the two cell arrays ...
Titus

1 comentario

Alex
Alex el 13 de Mayo de 2011
Hey thank you so much for the quick response!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 12 de Mayo de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by