Given an input character vector consisting of words, punctuation marks, white spaces, and possibly newline characters (\n), arrange the unique words alphabetically in a string array 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 = string({'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 R2016b documentation provides a good example of text data analysis via the string array approach. However, some steps illustrated in that example are unnecessary, and we can indeed accomplish the same task in a simpler way.
Related problems in this series:
the whole set of 2016b string challenge is just wonderful ! even for today, it is still looks advancing. Thank you for the thoughts and the work.
Thank you for your interest. Cody is already powered by the newest R2018a. It might be be a good time to start a R2018a challenge group :)
sharp 3rd output parameter idx!
340 Solvers
1735 Solvers
498 Solvers
Determine Whether an array is empty
561 Solvers
261 Solvers