Given an input character vector consisting of words, punctuation marks, white spaces, and possibly newline characters (\n), arrange the unique words alphabetically in a cell array of character vectors (formerly called cell array of strings) and calculate the histogram count of every unique word.
Assumptions:
For example, given the input txt as a character vector,
txt = 'I love MATLAB and Cody, but I don''t like trivial matlab problems on cody.';
the outputs should be
words = {'and';'but';'Cody';'don''t';'I';'like';'love';'MATLAB';... 'on';'problems';'trivial'}; count = [1; 1; 2; 1; 2; 1; 1; 2; 1; 1; 1];
Hint: The cell array of strings approach is the dual of the string array approach, i.e., things that can be done via the string arrays approach can also be done using the cell array approach.
Related problems in this series:
Determine if a Given Number is a Triangle Number
286 Solvers
307 Solvers
Find the largest value in the 3D matrix
897 Solvers
Combine the first and last names
105 Solvers
String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values
110 Solvers