Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use Matlab to create the function described below Function Name: catchyCounter Inputs: 1. (char) The filename of a text file containing lyrics to a song
Use Matlab to create the function described below
Function Name: catchyCounter Inputs: 1. (char) The filename of a text file containing lyrics to a song 2. (char) A word/phrase to count Outputs: 1. (double) The number of times the word/phrase appears Background: You are starting a job as a songwriter for some of the music industry's biggest stars. But before you can write your first hit single, you need to figure out what makes a song catchy. You find that repetition can be very effective, so you decide to count the number of times a specific word/phrase appears in notoriously catchy songs Function Description: Write a function in MATLAB that counts the number of times a certain word or phrase appears in a song's lyrics. The first input will be the filename of a .txt file that contains the lyrics to a song. The second input will be the word/phrase you are counting in those lyrics. Your function should output the total number of times that word/phrase appears in the .txt file, regardless of case Example: beat_it.txt: Just beat it, beat it, beat it, beat it No one wants to be defeated Showin' how funky and strong is your fight It doesn't matter who's wrong or right Just beat it (beat it) >> numcatchyCounter('beat_it.txt", 'beat it') num = 6 Notes: Because the phrase may be longer than one word, you should use strfind(). Also, the word or phrase that you are looking for might be a part of a larger word or phrase You do not need to check if a phrase occurs across multiple linesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started