This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Names of graphics objects


obj_names = namem
obj_names = namem(h)



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

Display a map in a figure window.

load korea
h = worldmap(map, refvec);
set(h, 'Visible', 'off')
geoshow(h, map, refvec, 'DisplayType', 'texturemap')

Get a list of all the names of graphics objects in the figure.

obj_names = namem
obj_names =

  6x8 char array

    'PLabel  '
    'MLabel  '
    'surface '
    'Frame   '

Convert the array of names into a cell array of character vectors.

obj_names_cell = cellstr(obj_names)
obj_names_cell =

  6x1 cell array

    {'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.

See Also

| | | | |

Introduced before R2006a

Was this topic helpful?