This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Enter Multiline Labels

The following state uses a multiline label:

There are two ways to enter multiline labels for states and transitions. In the following examples, sA is a handle to the State object in the chart for state A:

  • Use the MATLAB® function sprintf:

    str = sprintf('A\nen: entrA()\ndu: duriA()\nex: exitA()');
    sA.LabelString = str;

    In this example, the escape sequence \n inserts a new line into an expression.

  • Use a concatenated text expression:

    str = ['A',10,'entr: entrA()',10,'du: duriA()',...
          10,'ex: exitA()'];
    sA.LabelString = str;

    In this example, the ASCII equivalent of a new line, the integer 10, inserts new lines into a concatenated text expression.

Was this topic helpful?