Question: MATLAB D Question 8 Given the following function, answer the questions that follow. 1 functions - playSports (5) 2 viewers (s.Viewers] 3 - Index) =

MATLAB
MATLAB D Question 8 Given the following function, answer the questions that

D Question 8 Given the following function, answer the questions that follow. 1 functions - playSports (5) 2 viewers (s.Viewers] 3 - Index) = sort (viewers); 4 - (index); 5 for =1:length(s) s(1). Rating - index(i) . 5; if instruct(s(1). Equipment) S(1). Expensive true 11 10 if strcmp(s (i). Sport, Football') (1) - [1: 12 end 13 Emfield(s, "Viewers'); 14 end 15 end The following code is run in the command window. >> sports - playSports (sportsStruct) . sportsStruct " 'Track and field' Viewers: 1,500,000 1,000,000 Equipment: 1xl struct Spikes' 'Football' 3,000,000 1x struct # After the above code is run, which fieldnames are in the output structure array? b: After the above code is run, what is the size of the output structure array? Explain an example of a structure array that would cause the function to error. Include the wamber of the line the function would error on. This structure MUST have the fieldnames Sport, Viewers, and Equipment. Please answer the questions in order and indicate the beginning of each of your answers by putting the corresponding letter before your response. HTML Editor BIVA.A.I.EE 3. XEE mBe2 N O TT : 12pt - Paragraph - MacBook Pro CI Q Search or type URL # * w D Question 8 Given the following function, answer the questions that follow. 1 functions - playSports (5) 2 viewers (s.Viewers] 3 - Index) = sort (viewers); 4 - (index); 5 for =1:length(s) s(1). Rating - index(i) . 5; if instruct(s(1). Equipment) S(1). Expensive true 11 10 if strcmp(s (i). Sport, Football') (1) - [1: 12 end 13 Emfield(s, "Viewers'); 14 end 15 end The following code is run in the command window. >> sports - playSports (sportsStruct) . sportsStruct " 'Track and field' Viewers: 1,500,000 1,000,000 Equipment: 1xl struct Spikes' 'Football' 3,000,000 1x struct # After the above code is run, which fieldnames are in the output structure array? b: After the above code is run, what is the size of the output structure array? Explain an example of a structure array that would cause the function to error. Include the wamber of the line the function would error on. This structure MUST have the fieldnames Sport, Viewers, and Equipment. Please answer the questions in order and indicate the beginning of each of your answers by putting the corresponding letter before your response. HTML Editor BIVA.A.I.EE 3. XEE mBe2 N O TT : 12pt - Paragraph - MacBook Pro CI Q Search or type URL # * w

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 Accounting Questions!