Question: 28. Write a user-defined function that sorts the elements of a matrix. For the function name and arguments, use B = matrixsort(A), where A is

28. Write a user-defined function that sorts the elements of a matrix. For the function name and arguments, use B = matrixsort(A), where A is any size matrix and B is a matrix of the same size with the elements of A rearranged in descending order column after column with the (1,1) element the largest and the (m,n) element the smallest. If available, use the userdefined function downsort from the previous problem as a subfunction within matrixsort.
Test your function on a matrix with elements (integers) randomly distributed between –30 and 30. Use MATLAB’s randi function to generate the initial matrix.

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 Systems Analysis And Design Using MATLAB Questions!