Question
Matlab code Banned: fileread() and textscan() Function Name: moshUp Inputs: ( char ) Filename of a text file containing first song's lyrics ( char )
Matlab code
Banned: fileread() and textscan()
Function Name: moshUp
Inputs:
( char ) Filename of a text file containing first song's lyrics
( char ) Filename of a text file containing second song's lyrics
( char ) Filename of a text file containing the instructions on how to combine the songs
Outputs:
None
File Outputs:
1. A new text file containing the moshed -up song
Background:
After writing mashUp() , your first few singles (and eventually your debut album) caused quite a splash in the underground music scene and eventually earned you widespread popularity. Recently, however, your new weird friend (who always dresses in dark colors and listens to death metal) has inundated you with enough rhetoric that you no longer subscribe to conventional notions of popularity, traditional music structure, happiness, and society in general. Mash-ups are dead, and it's time to give the term "experimental music" new meaning.
Function Description:
A mosh -up is similar to a mash-up, but more avant-garde. Instead of only shuffling lines around, you'll shuffle around lines, words, and even characters. The first two inputs will be the lyrics from two songs, and the third file will be a text file containing the scheme for the mosh -up. The scheme will contain lines following the following format:
- - -
Each line will contain, at a minimum, the first two specifications (song number and line number), and can contain one or both of the other specifications (word number and character number). For example, the following line
1 - 4 - 6 means "take the sixth word from the fourth line from the first song and put it on the current line."
A line containing nothing but the world 'newline' in the scheme file indicates that a newline should be inserted into the new song at that point. A line containing nothing but the word 'space' indicates that a space should be inserted into the song at that point.
The name of your new text file should be
Example:
song1.txt: I seen some free landed some tricks Far I see high time man quit Won't let you know when I get goin Phone ring too long
song2.txt: But please be honest
Tell me was it you? I wont hate you I just need to know Please be honest Tell me was it you?
instructions.txt: 1-4
newline 2-6 newline 1-1-1 space 1-1-2 space 1-1-3 space 2-1-4-1 2-2-5-4
>> moshUp('song1.txt', 'song2.txt', 'instructions.txt') song1_song2_moshUp.txt:
Phone ring too long Tell me was it you? I seen some h?
Notes:
Don't insert newlines or spaces except where indicated in the instructions file.
The instructions file is guaranteed to only refer to existing words, lines or characters (i.e.
it won't ask for the fifth word on a line with only four words).
The output file should not have a trailing newline.
Only use spaces as delimiters to separate words.
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