Skip to Main Content Skip to Search
Product Documentation

properties - Class property names

Syntax

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

Description

properties('classname') displays the names of the public properties for the MATLAB class named by classname. The properties function also displays inherited properties.

properties(obj) 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.

Definitions

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

properties is also a MATLAB class-definition keyword. See classdef for more information on class definition keywords.

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

Alternatives

You can use the Workspace browser to browse current property values. See MATLAB Workspace Browser for more information on using the Workspace browser.

See Also

events | fieldnames | methods

Tutorials

  


» Learn more
» Download free kit
» Get trial software

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