2-D arrays -- Matrices
Matlab’s basic data structure is a 2-D array of numbers (1-D arrays are a special case of this). There are various ways to create 2-D arrays. Easiest is to list the rows separated by semicolons:
a = [1 2 3 4; 5 6 7 8; 9 10 11 12]
Functions are provided to construct arrays with m rows and n columns initialized in various ways.
rand(m,n) % m by n random
If A is a 2-D array, size(A) is a 1-D array containing the number of rows and columns in A.