Read-only pointer to variable from another workspace
#include "mex.h" const mxArray *mexGetVariablePtr(const char *workspace, const char *varname);
#include "fintrf.h" mwPointer mexGetVariablePtr(workspace, varname) character*(*) workspace, varname
mexGetVariablePtr to get a read-only
pointer to the specified variable,
your MEX-file workspace. This command is useful for examining an
data and characteristics. If you want to change data or characteristics,
mexGetVariable (along with
If you simply want to examine data or characteristics,
superior performance because the caller wants to pass only a pointer
to the array.
workspace— Workspace name
Workspace name you want
mexGetVariablePtr to search, specified
const char* in C or
character*(*) in Fortran.
The possible values are:
Search for the variable in the base workspace.
Search for the variable in the caller workspace.
Search for the variable in the global workspace.
varname— Variable name
Name of a variable in another workspace, specified as
in C or
character*(*) in Fortran. This is a variable name, not an
mxArray— Pointer to mxArray
Read-only pointer to the
mxArray on success, returned as
const mxArray* in C or
mwPointer in Fortran.
NULL in C or
0 in Fortran on
If you use this function in Simulink® S-functions, do not store the resulting
mxArray pointers in any S-function block state that persists after the
MEX function finishes. Outputs of this function have temporary scope and are automatically
destroyed at the end of the MEX function call.