Answered step by step
Verified Expert Solution
Question
1 Approved Answer
function updates = cowboyTryouts ( file , header ) % read file array = readcell ( file ) % get name column titles = array
function updates cowboyTryouts file header
read file
arrayreadcellfile
get name column
titles array:
info array:end,:
delete favorite horse that are grey
colorstrcmpititles'Horse Color'
color info:color
delete strcmpicolor 'gray'
infodelete:
Create a new column called Stats
which contains Lasso Time divided
by Draw Time rounded to second decimal place
lassostrcmpititles'Lasso Time'
lassoinfo:lasso
lasso cellmatlasso
draw strcmpititles 'Draw Time'
draw info:draw
draw cellmatdraw
Stats lasso.draw
Stats roundStats
titles titles 'Stats'
info info numcellStats
Sort the values based on
the column with the header
matching the second input string
in descending order
base strcmpititlesheader
col info:base
if ischarcol
header inds sortcol;
else
newVarinds sortcellmatcol
end
indsindsend::
Delete theinfo column with the header matching the second input string
infoinfoinds:
titles:base
info:base
updatestitles;info
end
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