Create a string array where every element is an empty string. You can preallocate a string array with
the strings function.
str = strings(2,3)
str = 2x3 string
""
""
""
""
""
""
To create a missing string, convert a missing value using the string function. The missing string
displays as.
str = string(missing)
str =
You can create a string array with both empty and missing strings. Use the ismissing function to
determine which elements are strings with missing values. Note that the empty string is not a
missing string.
str(1) = "";
str(2) = "Gemini";
str(3) = string(missing)
str = 1x3 string
""
"Gemini"
ismissing(str)
ans = 1x3 logical array
0
0
1
Compare a missing string to another string. The result is always 0 (false), even when you compare a
missing string to another missing string.
str = string(missing);
str == "Gemini"
ans = logical
0
str == string(missing)
ans = logical
0
Access Elements of String Array
String arrays support array operations such as indexing and reshaping. Use array indexing to access
the first row of str and all the columns.
Create String Arrays
6-7
the strings function.
str = strings(2,3)
str = 2x3 string
""
""
""
""
""
""
To create a missing string, convert a missing value using the string function. The missing string
displays as
str = string(missing)
str =
You can create a string array with both empty and missing strings. Use the ismissing function to
determine which elements are strings with missing values. Note that the empty string is not a
missing string.
str(1) = "";
str(2) = "Gemini";
str(3) = string(missing)
str = 1x3 string
""
"Gemini"
ismissing(str)
ans = 1x3 logical array
0
0
1
Compare a missing string to another string. The result is always 0 (false), even when you compare a
missing string to another missing string.
str = string(missing);
str == "Gemini"
ans = logical
0
str == string(missing)
ans = logical
0
Access Elements of String Array
String arrays support array operations such as indexing and reshaping. Use array indexing to access
the first row of str and all the columns.
Create String Arrays
6-7
