External Interfaces/API Reference | ![]() ![]() |
Get the name of the specified mxArray
C Syntax
#include "matrix.h" const char *mxGetName(const mxArray *array_ptr);
Arguments
array_ptr
Pointer to an mxArray
.
Returns
A pointer to the start of the name field. If the mxArray
has no name, the first element in the name field is \0.
Description
Use mxGetName
to determine the name of the mxArray
that array_ptr
points to.
The returned name is a NULL
-terminated character string. MATLAB variable names are stored in fixed-length character arrays of length mxMAXNAM+1
, where mxMAXNAM
is defined in the file mxArray.h
. Thus variable names can by any length up to mxMAXNAM
. The actual length is determined by the NULL
terminator.
mxGetName
passes back a pointer to an existing section of memory; therefore, your application should not allocate space to hold the returned name string. Do not attempt to deallocate or free the returned string.
Examples
See matdgns.c
in the eng_mat
subdirectory of the examples
directory. For an additional example, see explore.c
in the mex
subdirectory of the examples
directory.
See Also
![]() | mxGetN | mxGetNaN | ![]() |