ABCs_arrays

# ABCs_arrays - Store your answer in the variable"E"...

This preview shows page 1. Sign up to view the full content.

function [A B C D E F G H] = ABCs_arrays(mat1,mat2) % (a) Create an array that has the numbers 1, 2, and 5 in the first row, % and the numbers 9, 11, and 15 in the second. Store your answer in % the variable "A". A = [1 2 5; 9 11 15]; % (b) Create a array of ones that has 5 rows and 10 columns. Store your % answer in a variable called "B". B = ones(5,10); % (c) The array "mat1" has been given to you. Find the number of rows % and columns in "mat1", and save your answer in "C" (rows) and "D" % (columns). [C D] = size(mat1); % (d) Vertically concatenate the arrays "mat1" and "mat2".
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Store your % answer in the variable "E". E = [mat1; mat2]; % (e) Take the top half of the array stored in the variable % "mat2"- that is, take all of the columns and the first half of the % rows. Store your answer in the variable "F". F = mat2(1:round(end/2),:); % (f) Transpose "mat2". Save your answer in the variable "G". G = mat2'; % (g) Linearize "mat1". "mat1" should go from a MxN array to a (M*N)x1 % array. Store your answer in "H". H = mat1(:);...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern