Query graphics object properties
v = get(h)
v = get(h,propertyName)
v = get(h,propertyArray)
v = get(h,'default')
v = get(h,defaultTypeProperty)
v = get(groot,'factory')
v = get(groot,factoryTypeProperty)
Do not use the get
function on Java™ objects
as it will cause a memory leak. For more information, see Access Public and Private Data.
v = get(h)
returns all properties
and property values for the graphics object identified by h
. v
is
a structure whose field names are the property names and whose values
are the corresponding property values. h
can be
a single object or an m
-by-n
array
of objects. If h
is a single object and you do
not specify an output argument, then MATLAB® displays the information
on the screen.
v = get(h,propertyName)
returns
the value for the specific property, propertyName
.
Use single quotes around the property name, for example, get(h,'Color')
. If you do not specify an output argument, then MATLAB displays
the information on the screen.
v = get(h,propertyArray)
returns an m-by-n cell array,
where m is equal to length(h)
and n is
equal to the number of property names contained in propertyArray
.
v = get(h,'default')
returns
all default values currently defined on object h
in
a structure array. The field names are the object property names and
the field values are the corresponding property values. If you do
not specify an output argument, MATLAB displays the information
on the screen.
v = get(h,defaultTypeProperty)
returns
the current default value for a specific property. The argument defaultTypeProperty
is
the word default
concatenated with the object type
(e.g., Figure
) and the property name (e.g., Color
)
in single quotes. For example, get(groot,'defaultFigureColor')
.
v = get(groot,'factory')
returns
the factory-defined values of all user-settable properties in a structure
array. The field names are the object property names and the field
values are the corresponding property values. If you do not specify
an output argument, MATLAB displays the information on the screen.
v = get(groot,factoryTypeProperty)
returns the factory-defined value for a specific property. The argument factoryTypeProperty
is
the word factory
concatenated with the object type
(e.g., Figure
) and the property name (e.g., Color
)
in single quotes. For example, get(groot,'factoryFigureColor')
.
Create a line plot and return the chart line object as p
. List all the
properties of the line and the current property
values.
p = plot(1:10); get(p)
AlignVertexCenters: 'off' Annotation: [1x1 matlab.graphics.eventdata.Annotation] BeingDeleted: 'off' BusyAction: 'queue' ButtonDownFcn: '' Children: [] Clipping: 'on' Color: [0.9290 0.6940 0.1250] CreateFcn: '' DeleteFcn: '' DisplayName: '' HandleVisibility: 'on' HitTest: 'on' Interruptible: 'on' LineStyle: '-' LineWidth: 0.5000 Marker: 'none' MarkerEdgeColor: 'auto' MarkerFaceColor: 'none' MarkerSize: 6 Parent: [1x1 Axes] PickableParts: 'visible' Selected: 'off' SelectionHighlight: 'on' Tag: '' Type: 'line' ContextMenu: [] UserData: [] Visible: 'on' XData: [1 2 3 4 5 6 7 8 9 10] XDataMode: 'auto' XDataSource: '' YData: [1 2 3 4 5 6 7 8 9 10] YDataSource: '' ZData: [1x0 double] ZDataSource: ''
Create a line plot and return the chart line object as p
.
Use get
to return the current value of the LineWidth
property.
p = plot(1:10);
get(p,'LineWidth')
ans = 0.5000
Create a line plot with circle markers and return the chart
line object as p
. Use get
to
return the current values of the LineWidth
, Marker
,
and MarkerSize
properties for the object.
p = plot(1:10,'ro-'); props = {'LineWidth','Marker','MarkerSize'}; get(p,props)
ans = [0.5000] 'o' [6]
Return the default value of the LineWidth
property
defined on the root for all line graphics objects.
get(groot,'DefaultLineLineWidth')
ans = 0.5000