Text-only
Table of Contents (
frame
/
no frame
)
(6) String Arrays
String Arrays
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 Oct 17, 2007
Introduction
Table of Contents
(
frame
/
no frame
)
Printable
(single file)
© Dartmouth College