example
newStr
= split(str
)
divides str
at whitespace characters and returns the result as
the output array newStr
. The input array str
can be a string array, character vector, or cell array of character vectors. If
str
is a string array, then so is newStr
.
Otherwise, newStr
is a cell array of character vectors.
newStr
does not include the whitespace characters from
str
.
If str
is a string array or cell array of character vectors,
and has multiple elements, then each element must be divisible into the same number
of substrings.
-
If
str
is a string scalar or character vector, then
newStr
is an
N
-by-1
string array or cell
array of character vectors, whereN
is the number of
substrings. -
If
str
is an
M
-by-1
string array or cell
array, thennewStr
is an
M
-by-N
array. -
If
str
is a
1
-by-M
string array or cell
array, thennewStr
is an
1
-by-M
-by-N
array.
For a string array or cell array of any size, split
orients the
N
substrings along the first trailing dimension with a size
of 1
.
If the number of substrings is not the same for every element of
str
, then call split
in a
for
-loop to divide the elements of str
one
at a time.