Graphics    

Using Variables in Text Strings

Any string variable is a valid specification for the text String property. For example, each row of the matrix PersonalData contains specific information about a person (note that all but the longest row is padded with a space so that each has the same number of columns).

PersonalData = ['Jack Straw  ';'489 Main St.';'Wichita KN '];

To display the data, index into the desired row.

You can specify numeric variables in text strings using the num2str (number to string) function. For example, if you type on the command line,

MATLAB concatenates the three separate strings into one.

Since the result is a valid string, you can specify it as a value for the text String property.


 Including Symbols and Greek Letters in Text Strings Example - Multiline Text