Skip to Main Content Skip to Search
Product Documentation

Displaying Properties and Methods

Displaying Properties

To access the names of all properties for any particular object, use the get method. For example, if the object s is a State object, enter this command to list the properties and current values for any State object:

get(s);

To get a quick description for each property, use the help method. For example, if s is a State object, this command returns a list of State object properties, each with a small accompanying description:

s.help;

Displaying the Names of Methods

Use the methods method to list the methods for any object. For example, if the object t is a handle to a Transition object, use this command to list the methods for any Transition object:

t.methods;

Use a combination of the get method and the classhandle method to list only the names of the methods for an object. For example, list the names of the methods for the Transition object t with this command:

get(t.classhandle.Methods, 'Name');

Displaying Property Subproperties

Some properties are objects that have properties referred to as subproperties. For example, when you invoke the command get(ch) on a chart object, ch, the output displays the following for the StateFont property:

StateFont: [1x1 Stateflow.StateFont]

This value indicates that the StateFont property of a state has subproperties. To view the subproperties of StateFont, enter the command get(ch.StateFont) to see something like this:

Name: 'Helvetica'
Size: 12
Weight: 'NORMAL'
Angle: 'NORMAL'

This list shows that Name, Size, Weight, and Angle are subproperties of the property StateFont. In the API reference pages for this guide (see API Object Reference), these properties are listed by their full names: StateFont.Name, StateFont.Size, and so on.

Displaying Enumerated Values for Properties

Many API object properties can be set only to one of a group of enumerated strings. You can identify these properties from the API reference pages (see API Object Reference). When you use the get method to access object properties (see Displaying Properties) the values for these properties appear as strings of capital letters.

You can use the set method to display a list of acceptable strings for a property requiring enumerated values. For example, if ch is a handle to a Chart object, you can display the allowed enumerated values for the Decomposition property of that chart with this command:

set(ch,'Decomposition')
  


Free Stateflow Interactive Kit

Learn how engineers use Stateflow to model state machines in their Simulink models.


Get free kit

Trials Available

Try the latest version of Stateflow.


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