External Interfaces/API Reference    
mexGetArray

Get a copy of a variable from another workspace

C Syntax

Arguments
name
   Name of the variable to copy into the MEX-file workspace.

workspace
   Specifies where mexGetArray should search in order to find variable name. The possible values are:

base
Search for variable name in the current MATLAB workspace.
caller
Search for variable name in the workspace of whatever entity (M-file, another MEX-file, MATLAB) called this MEX-file.
global
Search for variable name in the list of global variables. If variable name exists but is not tagged as a global variable, then mexGetArray returns NULL.

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

mexGetArrayPtr, mexPutArray


 mexGet mexGetArrayPtr