Graphics    

Querying Property Values

Use get to query the current value of a property or of all the object's properties. For example, check the value of the current axes PlotBoxAspectRatio property.

MATLAB lists the values of all properties, where practical. However, for properties containing data, MATLAB lists the dimensions only (for example, CurrentPoint and ColorOrder).

Querying Individual Properties

You can obtain the data from the property by getting that property individually.

Returning a Structure

If you assign the output of get to a variable, MATLAB creates a structure array whose field names are the object property names and whose field values are the current values of the named property.

For example, if you plot some data, x and y,

and get the properties of the line object created by plot,

you can access the values of the line properties using the field name. This call to the text command places the string 'x and y data' at the first data point and colors the text to match the line color.

If x and y are matrices, plot draws one line per column. To label the plot of the second column of data, reference that line.

Querying Groups of Properties

You can define a cell array of property names and conveniently use it to obtain the values for those properties. For example, suppose you want to query the values of the axes "camera mode" properties. First define the cell array.

Use this cell array as an argument to obtain the current values of these properties.


  Setting Property Values Factory-Defined Property Values