| External Interfaces/API Reference | ![]() |
Get a copy of a variable from another workspace
C Syntax
#include "mex.h" mxArray *mexGetArray(const char *name, const char *workspace);
Arguments
name
Name of the variable to copy into the MEX-file workspace.
workspace
mexGetArray should search in order to find variable name. The possible values are:Returns
A copy of the mxArray on success. Returns NULL on failure. A common cause of failure is specifying a name not currently in the workspace. Perhaps the variable was in the workspace at one time but has since been cleared.
Description
Call mexGetArray to copy the specified variable name into your MEX-file's workspace. Once inside your MEX-file's workspace, your MEX-file may examine or modify the variable's data and characteristics.
The returned mxArray contains a copy of all the data and characteristics that variable name had in the other workspace. mexGetArray initializes the name field of the returned mxArray to the variable name.
Example
See mexgetarray.c in the mex subdirectory of the examples directory.
See Also
| mexGet | mexGetArrayPtr | ![]() |