Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help in MATLAB. Urgent Please. I got error in the last two statement. How to solve it? Thanks. You need to: - Read in

Need help in MATLAB. Urgent Please. I got error in the last two statement. How to solve it? Thanks.

image text in transcribedimage text in transcribedimage text in transcribed

You need to: - Read in the entire Excel workbook (there is only one worksheeet and do not specify any cell range). Save the text data in GradesTxt and the numeric data in GradesDat Calculate the final grade for the students. The grade distribution is the homework is worth 20% of the final grade, and each exam is worth 40%. Store the vector of all the final grades in the variable Final .Compute the average final grade and store it in AveGrade. .Find the maximum final grade and its position. Store them as MaxGrade and Maxlndex . Use the position stored in Maxlndex to find the name of the highest performing student and store it in MaxStudent. . Create an output message (using sprintf) and store it in the character array Results. The message should match the following message exactly "The average grade was XX.X with a maximum score of YY.Y by NNN." Where XX.X is the average grade, YY.Y is the maximum grade, and NN is the name of the student who made the maximum score. 1 %% Variables to be used 2 % Inputs 3 % CU3 141-G rades.xlsx is a spreadsheet as described in the problem statement 4 5 % Intermediate 6 % GradesTxt-cell array containing all the text data from the Excel sheet 7 % GradesDat-matrix containing all the numeric data from the Excel sheet 9 % Outputs 10 % Final-vector of all final grades 11 % AveGrade-average of all final grades 12 % MaxGrade -maximum of all final grades 13 % Maxindex- position of MaxGrade in Final vector 14 % Maxstudent - name of student who earned the maximum grade 15 % Results-character array containing formatted output statement 16 17 %% Inputs -Only edit this section if you are testing this code in MATLAB 18 % There are no inputs for this problem other than the Excel file which you will have to read in. 19 % You wil need to create your own copy of the Excel file to use when you run this code in MATLAB. 20 21 %% PROGRAM 22 % Start writing your program here 23 [GradesDat GradesTxt]-xlsread ( 'CU3141_Grades.xlsx'); 24 Homework-(GradesDat(1:end,1)*20)/100; 25 Exam1-(GradesDat (1:end,2)*40)/100; 26 Exam2-(GradesDat (1:end, 3)*40)/100; 27 Final-Homework+Exam1+Exam2; 28 AveGrade-mean (Final); 29 [MaxGrade MaxIndex]-max (Final(:)); 30 MaxStudent-GradesTxt (MaxIndex(1,: )) 31 Results-fprintf('The average grade was %0.2f% with a maximum score of %0.2f% by %s .AveG rade,MaxGrade,Ma 32 3 MaxStudent Check Variable MaxStudent has an incorrect value If you got the previous test correct (Maxlndex) then you need to check your row and column indexing. Be sure to account for any shifts due to header rows being ignored by xlsread. Refer back to the book section on xlsread. Results Check Variable Results must be of data type char. It is currently of type double. Check where the variable is assigned a value Output message stored in Results is not correct. Be sure to double checlk punctuation and spacing- the punctuation and spacing of your message has to match the example message exactly. numerical formatting - both numbers should be shown to one decimal places You need to: - Read in the entire Excel workbook (there is only one worksheeet and do not specify any cell range). Save the text data in GradesTxt and the numeric data in GradesDat Calculate the final grade for the students. The grade distribution is the homework is worth 20% of the final grade, and each exam is worth 40%. Store the vector of all the final grades in the variable Final .Compute the average final grade and store it in AveGrade. .Find the maximum final grade and its position. Store them as MaxGrade and Maxlndex . Use the position stored in Maxlndex to find the name of the highest performing student and store it in MaxStudent. . Create an output message (using sprintf) and store it in the character array Results. The message should match the following message exactly "The average grade was XX.X with a maximum score of YY.Y by NNN." Where XX.X is the average grade, YY.Y is the maximum grade, and NN is the name of the student who made the maximum score. 1 %% Variables to be used 2 % Inputs 3 % CU3 141-G rades.xlsx is a spreadsheet as described in the problem statement 4 5 % Intermediate 6 % GradesTxt-cell array containing all the text data from the Excel sheet 7 % GradesDat-matrix containing all the numeric data from the Excel sheet 9 % Outputs 10 % Final-vector of all final grades 11 % AveGrade-average of all final grades 12 % MaxGrade -maximum of all final grades 13 % Maxindex- position of MaxGrade in Final vector 14 % Maxstudent - name of student who earned the maximum grade 15 % Results-character array containing formatted output statement 16 17 %% Inputs -Only edit this section if you are testing this code in MATLAB 18 % There are no inputs for this problem other than the Excel file which you will have to read in. 19 % You wil need to create your own copy of the Excel file to use when you run this code in MATLAB. 20 21 %% PROGRAM 22 % Start writing your program here 23 [GradesDat GradesTxt]-xlsread ( 'CU3141_Grades.xlsx'); 24 Homework-(GradesDat(1:end,1)*20)/100; 25 Exam1-(GradesDat (1:end,2)*40)/100; 26 Exam2-(GradesDat (1:end, 3)*40)/100; 27 Final-Homework+Exam1+Exam2; 28 AveGrade-mean (Final); 29 [MaxGrade MaxIndex]-max (Final(:)); 30 MaxStudent-GradesTxt (MaxIndex(1,: )) 31 Results-fprintf('The average grade was %0.2f% with a maximum score of %0.2f% by %s .AveG rade,MaxGrade,Ma 32 3 MaxStudent Check Variable MaxStudent has an incorrect value If you got the previous test correct (Maxlndex) then you need to check your row and column indexing. Be sure to account for any shifts due to header rows being ignored by xlsread. Refer back to the book section on xlsread. Results Check Variable Results must be of data type char. It is currently of type double. Check where the variable is assigned a value Output message stored in Results is not correct. Be sure to double checlk punctuation and spacing- the punctuation and spacing of your message has to match the example message exactly. numerical formatting - both numbers should be shown to one decimal places

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

Students also viewed these Databases questions

Question

Explain how cultural differences affect business communication.

Answered: 1 week ago

Question

List and explain the goals of business communication.

Answered: 1 week ago