Graphics Programs Reference
you're the one
>> str = '''you''re the one'''
'you're the one'
Exercise 8 Create a table of integers from 0 to 255 and their
equivalent ascii values. Printing which ascii “character” rings
the system bell? (Answer on page 187.)
26.1 String Matrices
To create a matrix of strings, use the semicolon to separate the lines:
>> m = [alph ; char(num+5) ; 'KLMNO']
You cannot create a matrix of strings having different lengths:
>> z = [alph ; 'b']
??? All rows in the bracketed expression must have the
same number of columns.
(You should use cell arrays—discussed later—if you really want to create
a “matrix” like this.) To simulate the effect, though, you can pad with
>> z = ['abcd' ; 'b
The second line has three blank spaces to the right of the “b”. A conve-
nient way to do this is to use the char function, which does the padding
>> z = char('These','lines are','of varying lengths.')
of varying lengths.