This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

engGetVariable (C and Fortran)

Copy variable from MATLAB engine workspace

C Syntax

#include "engine.h"
mxArray *engGetVariable(Engine *ep, const char *name);

Fortran Syntax

mwPointer engGetVariable(ep, name)
mwPointer ep
character*(*) name



Engine pointer


Name of mxArray to get from MATLAB® workspace


Pointer to a newly allocated mxArray structure, or NULL if the attempt fails. engGetVariable fails if the named variable does not exist.


engGetVariable reads the named mxArray from the MATLAB engine session associated with ep.

The limit for the size of data transferred is 2 GB.

Use mxDestroyArray to destroy the mxArray created by this routine when you are finished with it.


See the following examples in matlabroot/extern/examples/eng_mat.

  • engdemo.c for a C example on UNIX® operating systems.

  • engwindemo.c for a C example on Microsoft® Windows® operating systems.

Was this topic helpful?