Question
Function Name civLeaders MATLAB Inputs 1. (char) Name of a text file with instructions Outputs None FileOutputs 1. A .txt file with the completed adventure
Function Name civLeaders
MATLAB
Inputs
1. (char) Name of a text file with instructions
Outputs
None
FileOutputs
1. A .txt file with the completed adventure
Background
You've decided to play a game of Civilization IV (the best Civilization game*)! The first
part of playing a game of Civilization is picking which leaders will be in the game. Each
civilization has several leaders to choose from, and it's hard for you to decide, so you turn to
MATLAB to help you choose!
FunctionDescription
You will be provided a text file that contains which leaders you pick from each
civilization. Each line will be of the format 'civilization.txt:leader' . Each civilization file
will be separated into the leaders you can pick, where each leader has a description paragraph.
In each file, the first line will be the name of one of the leaders, followed by a colon. The
paragraph associated with that leader will follow. Eventually, another leader's paragraph will
occur, again with a colon, and then the paragraph related to that leader.
For each line in the input file, open the text file specified to the left of the colon. Find the
leader whose name is to the right in that text file, and then copy the leader name and the
associated paragraph into a new text file with '_leaders' appended to the name of the input text
file.
Notes
Each leader's name will be one word.
The descriptions will not contain colons
There should be no extra new lines between paragraphs or at the end in the output file.
* According to one TA
Example
Homework 8 - Low Level I/O
cs1371.txt
kantwon:
Kantwon Rogers is a graduate student in the Human-Computer Interaction
degree program.
He also earned a BS in Computer Engineering and a MS in Electrical and
Computer Engineering from Georgia Tech.
His research interests lie in the area of computer science education and
increasing the involvement and success of Black students in the field.
smith:
David Smith is and Aerospace Engineer with 31 years of experience in
industry.
He is in his 20th year as a Lecturer in the College of Computing.
His primary accomplishment has been to design and implement CS1371.
civ1.txt
cs1371.txt:kantwon
civLeaders('civ1.txt')
civ1_leaders.txt
kantwon:
Kantwon Rogers is a graduate student in the Human-Computer Interaction
degree program.
He also earned a BS in Computer Engineering and a MS in Electrical and
Computer Engineering from Georgia Tech.
His research interests lie in the area of computer science education and
increasing the involvement and success of Black students in the field.
banned functions: fileread() and textscan()
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