"Adams,"
"John"
"Young,"
"Elizabeth"
"Burns,"
"Paul"
"Spencer,"
"Ann"
Join the last and first names. The join function places a space character between the strings it joins.
After the join, names is a 5-by-1 string array.
names = join(names)
names = 5x1 string
"Jones, Mary"
"Adams, John"
"Young, Elizabeth"
"Burns, Paul"
"Spencer, Ann"
Sort the elements of names so that they are in alphabetical order.
names = sort(names)
names = 5x1 string
"Adams, John"
"Burns, Paul"
"Jones, Mary"
"Spencer, Ann"
"Young, Elizabeth"
See Also
string | strings | strlength | ismissing | isspace | plus | split | join | sort
Related Examples
•
“Analyze Text Data with String Arrays” on page 6-15
•
“Search and Replace Text” on page 6-37
•
“Compare Text” on page 6-32
•
“Test for Empty Strings and Missing Values” on page 6-20
•
“Frequently Asked Questions About String Arrays” on page 6-59
•
“Update Your Code to Accept Strings” on page 6-64
Create String Arrays
6-11
"John"
"Young,"
"Elizabeth"
"Burns,"
"Paul"
"Spencer,"
"Ann"
Join the last and first names. The join function places a space character between the strings it joins.
After the join, names is a 5-by-1 string array.
names = join(names)
names = 5x1 string
"Jones, Mary"
"Adams, John"
"Young, Elizabeth"
"Burns, Paul"
"Spencer, Ann"
Sort the elements of names so that they are in alphabetical order.
names = sort(names)
names = 5x1 string
"Adams, John"
"Burns, Paul"
"Jones, Mary"
"Spencer, Ann"
"Young, Elizabeth"
See Also
string | strings | strlength | ismissing | isspace | plus | split | join | sort
Related Examples
•
“Analyze Text Data with String Arrays” on page 6-15
•
“Search and Replace Text” on page 6-37
•
“Compare Text” on page 6-32
•
“Test for Empty Strings and Missing Values” on page 6-20
•
“Frequently Asked Questions About String Arrays” on page 6-59
•
“Update Your Code to Accept Strings” on page 6-64
Create String Arrays
6-11
