Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

matlab Inputs: 1. (struct) An 1xN structure array 2 (char) A fieid name Outputs: (struct) An 1xM updaled strucbure array char) A descriptive statement about

image text in transcribed

matlab

Inputs: 1. (struct) An 1xN structure array 2 (char) A fieid name Outputs: (struct) An 1xM updaled strucbure array char) A descriptive statement about the dan battle 2 everyone's favorite childhood book serkes about dans of feral cats Rather than simply While reading anoce you realize that the plot is qute dmcult to keep up with at times. exciting adventures of the protagonist, Firepaw of he ThunderClan, ike a casual crodible reader, you decide to go the extra step Since you are such a dedicated fan of this in senes, you will write a MATLAB function to track the battles of the dans th Function Description: that takes in an 1xN structure anay and a feld name of a statistic thnat is the most important in a particular battle. Each structure in the array represents a diferent clan of cats. Based on the values quaranteed to be of type double, you wil determine which clans battle and wha wil win. Tha clan with the highest value in the given feld will win in a warrior battle aganst he clan with the lowest value in the given feid. Any intermediary clans will not be affected by the battle. Make the folowing updates to the stracture array based on this battle of the field from the given field name (sepond input) which are 1. The winning clan's structure's value in the field given by the secand input should be doubled. 2. The winning clan's structure's value af the Territories fioid, represented by a coil array of strings, should be updated to include the values of the Territories feld in the losing clan's structure. 3. The losing clan's value in the feld given by the second input should be set to zero. 4. The losing clan's value for the Territories fiald should become an empty cell array e values in the teld given by Sort the entire array in descending order based second input Do this using the descend input to sort. In addition to updating the structure array, the function shoud also output a descriptve following format the warrior code, fear leader against losing clan> Example: clans a NaveShadowclan ThunderCIan Brokens Leader: Firestar Territories'southeast woodlands') Strength:8 Territories'northeast sarshes' Strength: 7S [updatedclans, result] arriors(clans, 'Strength') updatedClans NaneThunderclan Leader : Firestar' Territories'southeast woodlands' northeast narshesh Strength168 Nane : ShadowClan Leader : 'Urokenstar' Territories: Strength : Firestar led result Thunderclan to victory against Shadouclan Follouing the warrior code, fearless leader Notes . The input structure array is guaranteed to have the folowing fields: 'Wane eader and Territoris . It is guaranteed that the values in the field given by the second input wil be a 1x1 double . It is guaranteed that the vaiue in the Territories field wil be a cell array .There will not be any tles

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions

Question

Discuss the importance of workforce planning.

Answered: 1 week ago

Question

Differentiate between a mission statement and a vision statement.

Answered: 1 week ago