CS 1132 lab exercise 6

These are optional exercises; they do not need to be submitted.

Obtaining subarrays—simple array vs. cell array

Type the following commands into the Matlab Command Window and observe both the screen output and the class (type) name in the Workspace pane.

m= rand(4,3)  % A 4-row-by-3-column matrix of numbers

a= m(2,:)     % One row vector that is the 2nd row of m
              % Note use of ()

C= {'ant', 'boo', 'cat'}  % A row cell array of length 3

D= C{2}                   % ______________________________ Note use of {}
                          % Braces are used to access the CONTENTS INSIDE
                          % an INDIVIDUAL cell. So D is a char row vector.

E= C(2:3)                 % ______________________________ Note use of ()
                          % Parentheses are used to get the cells, i.e.,
                          % the WRAPPERS AROUND the contents. Typically
                          % You will use () for VECTORIZED, as in
                          % multi-cell, code. So E is a cell array; it
                          % has length 2.

Assignment 3

Use any remaining time to work on Assignment 3.