Question: Matlab Code, Hardware and Software Integration Write a MATLAB function, named arrayCollide, that combines two input arrays, sorts them in the descending order, and then
Write a MATLAB function, named arrayCollide, that combines two input arrays, sorts them in the descending order, and then returns a new array of a specified size. Your MATLAB function should accept four inputs in the following order: 1. . firstArray: a 2-dimensional array of any size. .secondArray: another 2-dimensional array that may have a different size than that of firstArray. nRows: a number specifying the number of rows for the new output array ncols: a number specifying the number of columns for the new output array. Your MATLAB function should produce an output array, called resultarray, of size nRows-by- ncols that contains the first nRowsxnCols elements of arrays firstArray and secondArray, which are sorted in the descending order column-wise. If nRowsxnCols islarger than the total number of the elements in arrays firstArray and secondArray, then then function should fill empty spots with the minute portion of the current time. Test your function by writing a MATLAB script that repeatedly sets the values of firstArray secondArray, nRows, and nCols, and then calls the function arrayCollide to produce the output resultArray. You can use the built-in MATLAB functions like rand, randn, randi, magic, eye, etc. to generate these input arguments. This script should print the inputs, the output result, and the current time of running the script in a formatted text. You can create as many test cases as you wish For example, if firstArray3 21; 5 4 61 secondArray - [7 8; 9 10; 12 11] nRows3 ncols = 5 This test was run on 01/24/2019 at 10:54:25 resultArray
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
