Question
Matlab code Function Name: musicAwards Inputs: ( char) Filename of a text file containing the winners of a music awards show ( char) Category of
Matlab code
Function Name: musicAwards
Inputs:
( char) Filename of a text file containing the winners of a music awards show
( char) Category of award you need to change
( char) Artist and/or song you should substitute as the winner
Outputs:
None
File Outputs:
1. An updated text file containing the new winner under the appropriate category
Banned: fileread() and textscan()
Background:
You are a high-ranking official working for a certain music awards show. You have been trusted with the responsibility of getting the proper list of categories and winners on stage to be announced. However, youve discovered that someone has been changing the results of certain categories to the performers that they think should win. It is up to you to keep an eye on those categories that are potentially altered, and make sure that the correct winner gets announced on stage.
Function Description:
Write a function that will read through a text file to find the given category (2nd input), and change the winner to the one specified (3rd input). Then write the results to a new file, titled
Example:
results.txt: Album of the year: 24K Magic - Bruno Mars Song of the year: Despacito - Luis Fonsi Best Rap Song: HUMBLE. - Kendrick Lamar
>> musicAwards('results.txt', 'Song of the year', 'That's What I Like - Bruno Mars')
results_updated.txt: Album of the year: 24K Magic - Bruno Mars Song of the year: That's What I Like - Bruno Mars Best Rap Song: HUMBLE. - Kendrick Lamar
Notes:
The categories will always be separated from the songs/artist with a colon.
The category that you will have to change will never be on the last line of the text file.
Step 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