You can access individual characters or subsets of characters by indexing, just as you would index
into a numeric array.
seq(4:6)
ans =
'AGA'
Concatenate character vector with square brackets, just as you concatenate other types of arrays.
seq2 = [seq 'ATTAGAAACC']
seq2 =
'GCTAGAATCCATTAGAAACC'
Starting in R2019a, you also can concatenate text using append. The append function is
recommended because it treats string arrays, character vectors, and cell arrays of character vectors
consistently.
seq2 = append(seq,'ATTAGAAACC')
seq2 =
'GCTAGAATCCATTAGAAACC'
MATLAB functions that accept string arrays as inputs also accept character vectors and cell arrays of
character vectors.
See Also
string | char | cellstr | strlength | plus | horzcat | append
Related Examples
•
“Create String Arrays” on page 6-5
•
“Analyze Text Data with String Arrays” on page 6-15
•
“Frequently Asked Questions About String Arrays” on page 6-59
•
“Update Your Code to Accept Strings” on page 6-64
•
“Cell Arrays of Character Vectors” on page 6-12
6 Characters and Strings
6-4
Précédent

- 186/1450

Suivant