Access matlab variables from C

Hi, I am trying access the matlab variables from C. I am using the MATLAB engine to start matlab from C. When I read back the variable from matlab to c, it's in mxArray format. But how to read the data from this mxArray? Is there is any simple example file that I can refer to understand the concept. I check the explore.c from example/extern/mex/ but it's so confusing.
Regards Subin

1 comentario

Samuel Gray
Samuel Gray el 16 de Feb. de 2022
try to be more specific with your question..."it's so confusing" is, unfortunately, quite vague...

Iniciar sesión para comentar.

 Respuesta aceptada

Jan
Jan el 1 de Dic. de 2011
Editada: James Tursa el 16 de Feb. de 2022

0 votos

mxGetPr replies the pointer to the data of a DOUBLE array. For the other elementary types use e.g.:
int8_T *p;
p = (int8_T*) mxGetData(Data);
With Data is the mxArray pointer.

Más respuestas (0)

Categorías

Más información sobre C Shared Library Integration en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 1 de Dic. de 2011

Editada:

el 16 de Feb. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by