Row sort Write a function called CustomSort that takes an n x m 2D array inMat with random integers between -100 and 100 (inclusive), and produces an n x m array called outMat, which consists of...


Please answer in matlab code.


Row sort<br>Write a function called CustomSort that takes an n x m 2D array inMat with random integers between -100 and 100 (inclusive), and<br>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<br>outMat. CustomSort orders the remaining elements from left to right on the first row until the last column, progressing with each row.<br>Hint: The internal functions sort and reshape should be used.<br>Restrictions: Loops should not be used.<br>Ex:<br>inMat =<br>8.<br>19<br>8.<br>11<br>17<br>6<br>12<br>16<br>12<br>16<br>19<br>3];<br>= CustomSort( inMat )<br>11<br>16<br>[outMat]<br>produces<br>outMat =<br>2<br>2<br>3<br>6<br>8<br>8<br>11<br>11<br>12<br>12<br>16<br>16<br>16<br>17<br>19<br>19<br>Function e<br>Save<br>C Reset<br>MATLAB Documentation<br>1 function [outMat]<br>CustomSort( inMat )<br>2 % Takes a 2D array inMat with random integers between (inclusively) -100 and 100,<br>3 % and produces a<br>n by m array outMat that<br>consists of sorts values<br>4 % in inMat such that the lowest value in inMat is the (1,1) position<br>5 % in outMat, and order the remaining elements left to right on<br>6 % the first row till last column, starting with the next row and so on.<br>7<br>8<br>% Your code goes here %<br>9<br>outMat =<br>10 end<br>

Extracted text: Row sort Write a function called CustomSort that takes an n x 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 19 3]; = CustomSort( inMat ) 11 16 [outMat] produces outMat = 2 2 3 6 8 8 11 11 12 12 16 16 16 17 19 19 Function e Save C Reset MATLAB Documentation 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 outMat = 10 end
Row sort<br>Write a function called CustomSort that takes an n x m 2D array inMat with random integers between -100 and 100 (inclusive), and<br>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<br>outMat. CustomSort orders the remaining elements from left to right on the first row until the last column, progressing with each row.<br>Hint: The internal functions sort and reshape should be used.<br>Restrictions: Loops should not be used.<br>Ex:<br>inMat =<br>8.<br>19<br>8.<br>11<br>17<br>6<br>12<br>16<br>12<br>16<br>19<br>3];<br>= CustomSort( inMat )<br>11<br>16<br>[outMat]<br>produces<br>outMat =<br>2<br>2<br>3<br>6<br>8<br>8<br>11<br>11<br>12<br>12<br>16<br>16<br>16<br>17<br>19<br>19<br>Function e<br>Save<br>C Reset<br>MATLAB Documentation<br>1 function [outMat]<br>CustomSort( inMat )<br>2 % Takes a 2D array inMat with random integers between (inclusively) -100 and 100,<br>3 % and produces a<br>n by m array outMat that<br>consists of sorts values<br>4 % in inMat such that the lowest value in inMat is the (1,1) position<br>5 % in outMat, and order the remaining elements left to right on<br>6 % the first row till last column, starting with the next row and so on.<br>7<br>8<br>% Your code goes here %<br>9<br>outMat =<br>10 end<br>

Extracted text: Row sort Write a function called CustomSort that takes an n x 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 19 3]; = CustomSort( inMat ) 11 16 [outMat] produces outMat = 2 2 3 6 8 8 11 11 12 12 16 16 16 17 19 19 Function e Save C Reset MATLAB Documentation 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 outMat = 10 end
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here