Question: Given matrix C, write a program that sorts each row in the matrix. If the row is an odd numbered row, sort that row from

Given matrix C, write a program that sorts each row in the matrix. If the row is an odd numbered row, sort that row from smallest to largest. If the row is an even numbered row, sort that row from largest to smallest. Once this is completed, create a new matrix of the same size that is populated with the difference between the new values and the original values. For example A_11 is initially 13, but once the first row is sorted it will have a value of -5, so the new matrix will have a value of -18. Display the sorted matrix and the 'difference' matrix to the screen. C = [13 21 1 3 4 -5 7 17 13 7 0 7 8 1 0 -11 19 23 1 2 5 51 10 1.7 19 2 44 30 123 4 -4 12 6 77 8] Your program must work for any size matrix. You cannot use sort or sum or any such MATLAB functions. If you are in any doubt about what functions you can use, please raise your hand
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
