Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Matlab question 8. Write a script named arrayCollide that will combine two arrays, sort them, and then return a new array of a specified size.

image text in transcribedMatlab question

8. Write a script named arrayCollide that will combine two arrays, sort them, and then return a new array of a specified size. Your script should process the following data: -A: a 2-D array of any size B: another 2-D array that may be a different size from A N: a number specifying the number of rows for the new array - M: a number specifying the number of columns for the new array. Your script should produce an array, res, of size N x M that contains the first N x M elements of A and B and is sorted columnwise. If N x M is larger than the total number of elements in A and B, you should fill empty spots with O Test this script by writing another script that repeatedly sets the values of A, B, M, and N and then invokes your arrayCollide script. You can then create as many test cases as you wish. For example, if A1 2 3; 5 4 61, B [7 8; 9 10; 12 11], N 3 and M 4, res will be [1 4710 2 5 8 11 369 12 Change N to 4, and res will be [1 5 9 26 10 0 3 7 110 4812 0]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions