Split a character string into a table of substrings
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
text2tbl splits a character string into a
table of substrings, using the strings in the list
text2tbl returns a table, using the
and so on.
Without the option
Cyclic, the text is split
as follows. The first occurrence of one of the delimiters in
text. If no delimiter is found, the
full text is returned as the only substring. Otherwise, the substring
up to the delimiter defines the first substring. The delimiter is
the second substring. The remaining text is processed as above until
there are no more characters left. The result does not depend on the
order of the delimiters.
With the option
Cyclic, the first delimiter
separators is used to identify the first substring.
The delimiter itself is the second substring. Then the second delimiter
separators is used to identify the third substring,
and so on. After using the last delimiter of the list, the first one
is used again, until the whole text is processed or until the current
delimiter is not found in the remaining text. The result depends on
the order of the delimiters.
strings split by
text2tbl is a function of the system kernel.
text2tbl with and without the option
text2tbl("This is a simple example!", ["is", "mp"])
text2tbl("This is a simple example!", ["is", "mp"], Cyclic)
The text to be analyzed: a character string
Delimiters: a list of character
strings. The empty string
The delimiter list is used cyclically.
Table of character strings.