doc2cell - Convert documents to cell array of string vectors - MATLAB (original) (raw)
Main Content
Convert documents to cell array of string vectors
Syntax
Description
[C](#d126e17126) = doc2cell([documents](#d126e17106))
converts a tokenizedDocument
array to a cell array. The entries ofC
are string arrays containing the corresponding words in each document.
Examples
Convert Document Array to Cell Array
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.
ans = 1x6 string "an" "example" "of" "a" "short" "sentence"
Output Arguments
C
— Output cell array
cell array of string vectors
Output cell array of string vectors. Each element ofC
is a string vector containing the words of the corresponding document.
Version History
Introduced in R2017b