Main Content

doc2cell

Convert documents to cell array of string vectors

Description

example

C= doc2cell(documents)converts atokenizedDocumentarray to a cell array. The entries ofCare string arrays containing the corresponding words in each document.

Examples

collapse all

Convert atokenizedDocumentarray 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 = doc2cell(documents)
C=1×2 cell array{["an" "example" ... ]} {["a" "second" ... ]}

View the first element of the cell array.

C{1}
ans =1x6 string"an" "example" "of" "a" "short" "sentence"

Input Arguments

collapse all

Input documents, specified as atokenizedDocumentarray.

Output Arguments

collapse all

Output cell array of string vectors. Each element ofCis a string vector containing the words of the corresponding document.

Version History

Introduced in R2017b