Write a user-defined function that sorts the elements of a matrix. For the function name and arguments,

Question:

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 (m x n) matrix and B is a matrix of the same size with the elements of A rearranged in descending order row after row with the (1,1) element the largest and the (m,n) element the smallest. If available, use the user-defined function downsort from Problem 26 as a subfunction within matrixsort.
Test your function on a 4 x 7 matrix with elements (integers) randomly distributed between -30 and 30. Use MATLAB's randi function to generate the initial matrix.
Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: