Thursday, August 13, 2009

get

Get object properties

Syntax

  • get(h)
    get(h,'PropertyName')
    = get(H,)
    a = get(h)
    a = get(0,'Factory')
    a = get(0,'FactoryObjectTypePropertyName')
    a = get(h,'Default')
    a = get(h,'DefaultObjectTypePropertyName')

Description

get(h) returns all properties and their current values of the graphics object identified by the handle h.

get(h,'PropertyName') returns the value of the property 'PropertyName' of the graphics object identified by h.

= get(H,pn) returns n property values for m graphics objects in the m-by-n cell array, where m = length(H) and n is equal to the number of property names contained in pn.

a = get(h) returns a structure whose field names are the object's property names and whose values are the current values of the corresponding properties. h must be a scalar. If you do not specify an output argument, MATLAB displays the information on the screen.

a = get(0,'Factory') returns the factory-defined values of all user-settable properties. a is a structure array whose field names are the object property names and whose field values are the values of the corresponding properties. If you do not specify an output argument, MATLAB displays the information on the screen.

a = get(0,'FactoryObjectTypePropertyName') returns the factory-defined value of the named property for the specified object type. The argument, FactoryObjectTypePropertyName, is the word Factory concatenated with the object type (e.g., Figure) and the property name (e.g., Color).

  • FactoryFigureColor

a = get(h,'Default') returns all default values currently defined on object h. a is a structure array whose field names are the object property names and whose field values are the values of the corresponding properties. If you do not specify an output argument, MATLAB displays the information on the screen.

a = get(h,'DefaultObjectTypePropertyName') returns the factory-defined value of the named property for the specified object type. The argument, DefaultObjectTypePropertyName, is the word Default concatenated with the object type (e.g., Figure) and the property name (e.g., Color).

  • DefaultFigureColor

Examples

You can obtain the default value of the LineWidth property for line graphics objects defined on the root level with the statement:

  • get(0,'DefaultLineLineWidth')
    ans =
    0.5000

To query a set of properties on all axes children define a cell array of property names:

  • props = {'HandleVisibility', 'Interruptible';
    'SelectionHighlight', 'Type'};
    output = get(get(gca,'Children'),props);

The variable output is a cell array of dimension
length(get(gca,'Children')-by-4.

For example, type

  • patch;surface;text;line
    output = get(get(gca,'Children'),props)
    output =
    'on' 'on' 'on' 'line'
    'on' 'off' 'on' 'text'
    'on' 'on' 'on' 'surface'
    'on' 'on' 'on' 'patch'


get (COM)



Retrieve a property value from an interface or get a list of properties

Syntax

  • v = get(h[, 'propertyname'])

Arguments

h
Handle for a COM object previously returned from actxcontrol, actxserver, get, or invoke.

propertyname
A string that is the name of the property value to be retrieved.

Description

Returns the value of the property specified by propertyname. If no property is specified, then get returns a list of all properties for the object or interface.

The meaning and type of the return value is dependent upon the specific property being retrieved. The object's documentation should describe the specific meaning of the return value.

Examples

Create a COM server running Microsoft Excel:

  • e = actxserver ('Excel.Application');

Retrieve a single property value:

  • get(e, 'Path')
    ans =
    D:\Applications\MSOffice\Office

Retrieve a list of all properties for the CommandBars interface:

  • c = get(e, 'CommandBars');
    get(c)
    ans =
    Application: [1x1
    Interface.excel.application.CommandBars.Application]
    Creator: 1.4808e+009
    ActionControl: []
    ActiveMenuBar: [1x1
    Interface.excel.application.CommandBars.ActiveMenuBar]
    Count: 94
    DisplayTooltips: 1
    DisplayKeysInTooltips: 0
    LargeButtons: 0
    MenuAnimationStyle: 'msoMenuAnimationNone'
    Parent: [1x1
    Interface.excel.application.CommandBars.Parent]
    AdaptiveMenus: 0
    DisplayFonts: 1


get (serial)


Return serial port object properties

Syntax

  • get(obj)
    out = get(obj)
    out = get(obj,'PropertyName')

Arguments


obj
A serial port object or an array of serial port objects.
'PropertyName'
A property name or a cell array of property names.
out
A single property value, a structure of property values, or a cell array of property values.

Description

get(obj) returns all property names and their current values to the command line for obj.

out = get(obj) returns the structure out where each field name is the name of a property of obj, and each field contains the value of that property.

out = get(obj,'PropertyName') returns the value out of the property specified by PropertyName for obj. If PropertyName is replaced by a 1-by-n or n-by-1 cell array of strings containing property names, then get returns a 1-by-n cell array of values to out. If obj is an array of serial port objects, then out will be a m-by-n cell array of property values where m is equal to the length of obj and n is equal to the number of properties specified.

Remarks

Refer to Displaying Property Names and Property Values for a list of serial port object properties that you can return with get.

When you specify a property name, you can do so without regard to case, and you can make use of property name completion. For example, if s is a serial port object, then these commands are all valid.

  • out = get(s,'BaudRate');
    out = get(s,'baudrate');
    out = get(s,'BAUD');

If you use the help command to display help for get, then you need to supply the pathname shown below.

  • help serial/get

Example

This example illustrates some of the ways you can use get to return property values for the serial port object s.

  • s = serial('COM1');
    out1 = get(s);
    out2 = get(s,{'BaudRate','DataBits'});
    get(s,'Parity')
    ans =
    none

No comments:

Post a Comment