Main Content


Names of graphics objects



obj_names = namem returns the names of all the objects on the current axes. The name of an object is the value of its Tag property, if specified. Otherwise, the name of the object is the value of its Type property. The values of these properties are either set at object creation or defined using the tagm function.

obj_names = namem(h) returns the name of the object (or objects) specified by the array, h.


collapse all

Load elevation data and a geographic cells reference object for the Korean peninsula. Then, display the data on a world map.

load korea5c

Find the names of graphics objects in the figure. The namem function returns the names as a character array. Convert the array into a cell array of character vectors using cellstr.

namesChar = namem
namesChar = 6x8 char array
    'PLabel  '
    'MLabel  '
    'surface '
    'Frame   '

namesCell = cellstr(namesChar)
namesCell = 6x1 cell
    {'PLabel'  }
    {'MLabel'  }
    {'surface' }
    {'Frame'   }

Input Arguments

collapse all

Graphics objects, specified as an array.

Output Arguments

collapse all

Names of graphics objects, returned as a character array. namem removes duplicate object names from the array.

Note: Use cellstr(obj_names) to convert obj_names to a cell array of character vectors.

Version History

Introduced before R2006a

See Also

| | | | |