**MATLAB **PLEASE DON'T DO IT IF YOU ARE NOT VERY SURE ABOUT YOUR WORK!! Function Name: minefield Inputs: 1. ( char ) Filename of the
**MATLAB
**PLEASE DON'T DO IT IF YOU ARE NOT VERY SURE ABOUT YOUR WORK!!
Function Name: minefield Inputs: 1. ( char ) Filename of the text file containing minefield maps, with extension Outputs: 1. ( double ) Number of mines in field 2. ( char ) A string stating how dangerous the field is Background: As a high ranking General in the U.S. Army, the President has asked you to participate in planning a top secret invasion, Operation Overlord, in order to liberate Western Europe from evil's clutches. It is your job to find the safest beach for forces to land on, as the opposition has planted mines in many of the areas. American spies in Europe have been able to obtain the maps of how the mines have been planted. Using MATLAB, you must analyze these maps and find the best course of action. Function Description: You will be provided a text file that represents a field. Mines will be represented in the text file with the character, '*' . Write a function that counts and outputs the number of mines in the field. If there are fewer than 5 mines in the entire field, the field is considered safe, and the string output should be: 'This beach seems like a good landing spot!' . Otherwise the string output should be: 'We can not risk our soldiers here!' . Example: Minefield.txt __________ |* USA * | | * * * | |Freedom_*_| >> [mineCount, dangerLevel] = minefield('Minefield.txt') mineCount = 6 dangerLevel = 'We can not risk our soldiers here!' Notes: Only the '*' character is considered a mine.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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