| Stateflow® | ![]() |
In the examples shown thus far of entering labels for states and transitions, only a simple one-line expression has been used. This figure shows state A with a multiline label.

There are two ways to enter multiline labels for both states and transitions. In these examples, sA is a handle to the State object in the Stateflow® API for state A:
Use the MATLAB® function sprintf:
str = sprintf('A\nen: entrA()\ndu: duriA()\nex: exitA()')
sA.LabelString = str
In this example, carriage returns are inserted into a string expression with the escape sequence \n.
Use a concatenated string expression:
str = ['A',10,'entr: entrA()',10,'du: duriA()',
10,'ex: exitA()']
sA.LabelString = str
In this example, carriage returns are inserted into a concatenated string expression with the ASCII equivalent of a carriage return, the integer 10.
![]() | Using the Editor Object | Creating Default Transitions | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |