Problem 1757. Letter and word frequency

Here is a task:

You’re given a text file. Your first task is to create a variable in MATLAB which will hold the text given to you. You want to know: a. How many letters are present in this text? b. How many “e”s are present in the text? c. What percentage of the text do they correspond to? d. How many words are there in the text given to you? (Hint: Count the number of spaces.)

Write a function textCount1 that takes as a parameter a string which is the name of the text file. For example, if you wanted to do this analysis on a file named data.txt in your working directory, you would invoke textCount1('data.txt').

The result of the function should be a vector consisting of the number of e's and the number of words. Cody will supply the test file which will be the parameter for your function.

Solution Stats

50.0% Correct | 50.0% Incorrect
Last Solution submitted on Apr 19, 2019

Problem Recent Solvers14

Suggested Problems

More from this Author1

Problem Tags