Question: cowboyTryouts Function Name: cowboyTryouts Input: ( 1 N char ) A Cell Array containing data about horses ( 1 M char ) A header name

cowboyTryouts
Function Name: cowboyTryouts
Input:
(1 N char ) A Cell Array containing data about horses
(1 M char ) A header name of a column in the cell array. The column may containing data of type
double OR char.
Output:
(cell ) A cell array with updated information
Description:
You are given a cell array containing data about the different cowboys who are trying out for the team.
The cell array is guaranteed to contain the following columns in no particular order (there may be more
columns):
'Horse Color' (this column contains all chars)
'Lasso Time' (this column contains all doubles)
'Draw Time' (this column contains all doubles)
Your code should do the following in order:
1. Delete all of the rows with horses whose color is 'Gray' (case insensitive)
2. Create a new column with the header 'Stats' in the last column. This column should contain Lasso
Time divided by Draw Time rounded to the second decimal place for each cowboy.
3. Delete the columns containing 'Lasso Time' and 'Draw Time'
4. Sort the values based on the column with the header matching the second input string in descending
order
10
Week 0807- Cell Arrays Fall 2024
Examples:
data ={'Name' 'Horse Name' 'Lasso Time' 'Horse Color' 'Draw Time' 'Ranking' 'Farm'
'Amber' 'Bessie Bluebird' 19 'White' 0.70004 'Harlindale'
'Jessie' 'Kansas Clara Belle' 18 'Black' 0.30005 'Spring Lake'
'Javier' 'Juniper Run' 20 'Gray' 0.40001 'Fausey Medows'
'Franklin' 'Fazia Tanier' 16 'Beige' 0.20008 'Castleberry Hills'
'Dawn' 'Quiet Decanter' 21 'Gray' 0.60004 'Crenshaw Falls'
'Gerald' 'Chicago Slim' 17 'White' 0.30002 'Easter Station'
'Maria' 'Gertrude' 18 'Gray' 0.50006 'Back 40'};
updated = cowboyTryouts(data,'Stats')
updated = cowboyTryouts(data,'Ranking')
updated = cowboyTryouts(data,'Horse Name')
Notes:
The first row of the input cell array contains headers and each column contains only one data type.
You can't use the 'descend' input when dealing with cell arrays of chars. Instead you have to sort it
by default in ascending order and then reverse the outputs.
You will not have to sort by 'Lasso Time' or 'Draw Time'.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!