Main Content

isCommented

(Removed) Determine if graphical object is commented out

isCommented has been removed. Use the property IsCommented instead. For information on updating your code, see Version History.

Description

example

tf = isCommented(graphicalObject) returns a logical value that indicates if a graphical object is commented out. The function returns logical 1 (true) if:

  • The graphical object is explicitly commented out. To explicitly comment out an object, set its IsExplicitlyCommented property to true. Alternatively, you can right-click the graphical object and select Comment Out.

  • The graphical object is implicitly commented out. In this case, its IsImplicitlyCommented property has a value of true. An object is implicitly commented out when you explicitly comment out a state, box, or function that contains the object. Additionally,

    • Transitions are implicitly commented out when you comment out their source or destination.

    • Entry and exit ports are implicitly commented out when you comment out their matching entry or exit junction.

Otherwise, the function returns logical 0 (false).

Examples

collapse all

When you explicitly comment out a state, box, or function, you implicitly comment out all the graphical objects that it contains. For example, when you comment out state A in this chart, you also comment out its substates, A1 and A2.

Stateflow chart with a hierarchy of states. The outer state is called A. It contains two inner states called A1 and A2.

Find the Stateflow.State objects named A, A1, and A2.

sA = find(ch,"-isa","Stateflow.State",Name="A");
sA1 = find(ch,"-isa","Stateflow.State",Name="A1");
sA2 = find(ch,"-isa","Stateflow.State",Name="A2");

Check that state A and its substates are not commented out.

[isCommented(sA),isCommented(sA1),isCommented(sA2)]
ans =

  1×3 logical array

   0   0   0

Explicitly comment out state A.

sA.IsExplicitlyCommented = true;

Check that state A and its substates are commented out.

[isCommented(sA),isCommented(sA1),isCommented(sA2)]
ans =

  1×3 logical array

   1   1   1

Input Arguments

collapse all

Version History

Introduced in R2016a

collapse all

R2023a: Removed

isCommented has been removed. To determine whether a graphical object is commented out, use the property IsCommented instead:

tf = graphicalObject.IsCommented
For more information, see Comment Out State.