CSE 7 Lecture Notes - Lecture 6: Matlab, Mexican Peso
Document Summary
Always refer to row first, column second. >>mat=[1:3; 6 11 -2] mat= 1 2 3. What is mat(m,:) mth row, all columns. Last row, nth value mat(end, n) Any subset (same dimensions as modified subset) Exception: if subset is assigned to a scalar then scalar replaces every subset element individual element (assign new value) Functions for dimensions length(vec) returns the number of elements in a vector length(mat) returns larger dimension (row or col) for matrix. Size returns the number of rows and columns for the array. Have dimensions m x n x p. Ex: 3 x 5 x2 matrix (2 layers) 38 33 25 29 13 this is layer 1. 14 8 48 11 25 ans(:,:,2)= 35 27 13 41 17. 45 7 42 12 10 this is layer 2. Which type may hold -4 in 4 bytes? int32 because there are 8 bits in a byte 8*4= 32. Algorithm: step by step method to solve a problem.