External Interfaces/API Reference |
Get a read-only pointer to a variable from another workspace
C Syntax
Arguments
var_name
Name of a variable in another workspace. (Note that this is a variable name, not an mxArray
pointer.)
workspace
Specifies which workspace you want mexGetVariablePtr
to search. The possible values are:
base |
Search for the variable in the base workspace |
caller |
Search for the variable in the caller's workspace |
global |
Search for the variable in the global workspace |
Returns
A read-only pointer to the mxArray
on success. Returns NULL
on failure.
Description
Call mexGetVariablePtr
to get a read-only pointer to the specified variable, var_name
, into your MEX-file's workspace. This command is useful for examining an mxArray's
data and characteristics. If you need to change data or characteristics, use mexGetVariable
(along with mexPutVariable
) instead of mexGetVariablePtr
.
If you simply need to examine data or characteristics, mexGetVariablePtr
offers superior performance as the caller need pass only a pointer to the array.
Examples
See mxislogical.c
in the mx
subdirectory of the examples
directory.
See Also
mexGetVariable | mexIsFinite (Obsolete) |