Help CenterHelp Center
Convert documents to cell array of string vectors
C = doc2cell(documents)
example
C = doc2cell(documents) converts a tokenizedDocument array to a cell array. The entries of C are string arrays containing the corresponding words in each document.
C
documents
tokenizedDocument
collapse all
Convert a tokenizedDocument array to a cell array of string vectors.
documents = tokenizedDocument([ ... "an example of a short sentence" ... "a second short sentence"])
documents = 1x2 tokenizedDocument: 6 tokens: an example of a short sentence 4 tokens: a second short sentence
C=1×2 cell array {["an" "example" "of" "a" "short" "sentence"]} {["a" "second" "short" "sentence"]}
View the first element of the cell array.
C{1}
ans = 1x6 string "an" "example" "of" "a" "short" "sentence"
Input documents, specified as a tokenizedDocument array.
Output cell array of string vectors. Each element of C is a string vector containing the words of the corresponding document.
Introduced in R2017b
context | doclength | joinWords | string | tokenizedDocument
context
doclength
joinWords
string
You have a modified version of this example. Do you want to open this example with your edits?
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other bat365 country sites are not optimized for visits from your location.
Contact your local office