properties - Display class property names

Syntax

properties('classname')
properties(obj)
p = properties(...)

Description

properties('classname') displays the names of the public properties for the MATLAB class classname, including public properties inherited from superclasses.

properties(obj) displays the names of the public properties for the class of the object obj, where obj is an instance of a MATLAB class. obj can be either a scalar object or an array of objects. When obj is scalar, properties also returns dynamic properties.

See Dynamic Properties — Adding Properties to an Instance for information on using dynamic properties.

p = properties(...) returns the property names in a cell array of strings. Note that you can use the Workspace browser to browse current property values. See MATLAB Workspace for more information on using the Workspace browser.

A property is public when its GetAccess attributes are set to public and its Hidden attribute is set to false (default values for these attributes). See Property Attributes for a complete list of attributes.

You can also use the fieldnames function to list property names of MATLAB classes.

See Properties — Storing Class Data for more information on class properties.

Examples

Retrieve the names of the public properties of class memmapfile and store the result in a cell array of strings:

p = properties('memmapfile');
p
ans = 

    'writable'
    'offset'
    'format'
    'repeat'
    'filename'

Construct an instance of the MException class and get its properties names:

me = MException('Msg:ID','MsgText');
properties(me)
Properties for class MException:

    identifier
    message
    cause
    stack

See Also

events, fieldnames, methods

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS