Row sort Write a function called CustomSort that takes an nx m 2D array inMat with random integers between -100 and 100 (inclusive), and produces an n x m array called outMat, which consists of sorted values in inMat such that the lowest value in inMat is the (1,1) position in outMat. CustomSort orders the remaining elements from left to right on the first row until the last column, progressing with each row. Hint: The internal functions sort and reshape should be used. Restrictions: Loops should not be used. Ex: inMat = [ 8 19 8 11 17 6 12 16 12 16 2 19 11 16 3]; [outMat] = CustomSort( inMat ) produces outMat = 2 3 6 8 8 11 11 12 12 16 16 16 17 19 19 Function e A Save CReset I MATLAB Documentatio 1 function [outMat] = CustomSort( inMat ) 2 % Takes a 2D array inMat with random integers between (inclusively) -100 and 100, 3 % and produces a n by m array outMat that consists of sorts values 4 % in inMat such that the lowest value in inMat is the (1,1) position 5 % in outMat, and order the remaining elements left to right on 6 % the first row till last column, starting with the next row and so on. 7 8 % Your code goes here % 9 10 end 11 Code to call your function 0 C Reset 1 inMat=randi(10,4,4)-5; 2 [outMat] = CustomSort( inMat )
Row sort Write a function called CustomSort that takes an nx m 2D array inMat with random integers between -100 and 100 (inclusive), and produces an n x m array called outMat, which consists of sorted values in inMat such that the lowest value in inMat is the (1,1) position in outMat. CustomSort orders the remaining elements from left to right on the first row until the last column, progressing with each row. Hint: The internal functions sort and reshape should be used. Restrictions: Loops should not be used. Ex: inMat = [ 8 19 8 11 17 6 12 16 12 16 2 19 11 16 3]; [outMat] = CustomSort( inMat ) produces outMat = 2 3 6 8 8 11 11 12 12 16 16 16 17 19 19 Function e A Save CReset I MATLAB Documentatio 1 function [outMat] = CustomSort( inMat ) 2 % Takes a 2D array inMat with random integers between (inclusively) -100 and 100, 3 % and produces a n by m array outMat that consists of sorts values 4 % in inMat such that the lowest value in inMat is the (1,1) position 5 % in outMat, and order the remaining elements left to right on 6 % the first row till last column, starting with the next row and so on. 7 8 % Your code goes here % 9 10 end 11 Code to call your function 0 C Reset 1 inMat=randi(10,4,4)-5; 2 [outMat] = CustomSort( inMat )
Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 1RQ
Related questions
Question
Please answer in matlab code.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,