Text-only
Table of Contents (
frame
/
no frame
)
(15) String Arrays
String Array
s
created using single quotes
stored as row vectors and takes 2 bytes per character
use [,] to concatenate strings
use [;] to vertically concatenate strings (must be of equal length)
use strvcat to vertically concatenate strings arrays of non-equal length
Try:
>>str1='Hi there. '
str2='How are you?'
str3= 'Bye'
c1= [str1,' ',str2] % join two strings
c2 = [str1;str2] % vertical concatenation (must be same length)
c3=strvcat(str1,str2,str3) % vertically concatenate (matrix)
String_Arrays.src last modified Sep 29, 2009
Introduction
Table of Contents
(
frame
/
no frame
)
Printable
(single file)
© Dartmouth College