What happens if you try to open a file for reading that doesnt exist? What happens ifyou try to open a file for writing that doesnt exist?
ENGR 121 B Lecture Notes for 9/26/2016 Spencer Kociba Summary of Lecture: how to classify, categorize, modify and conduct operations using matrices and vectors in MATLAB (which stands for Matrix Laboratory) MATRICES ● Matrix: stores a set of values of the same type ○ every value is an element ○ Matrix = m rows, n columns ● Creating Matrices ○ Ex. >> m=[ 1,4,6; 7,8,10; 2,7,15; 3,7,8] becomes a 4x3 matrix ■ 1,4,6 = 1st row, 7,8,10 = 2nd row, etc. ■ ; indicates the end of a row ■ MATLAB will show an error if your elements and the size of the matrix don’t add up ○ >>z=10*rand(3,5) becomes a 3x5 matrix with random numbers from (0,10) ○ >>z(1,2) refers to row 1, column 2 element ○ >>z(2,:) refers to all elements in row 2 ○ >>z(:,2) refers to all elements in column 2 ○ >>z([1,3], end) refers to 1st and 3rd row elements of the last column ● Matrix Multiplication ○ Maxtrix * Matrix = New Matrix ○ In A (n x m) and B (N x M), in order to multiply A*B, m=N. To multiply B*A, M=n ○ >>x=A*B ○ x.^(a) raises each element in matrix x by the power of a ● Matrix f