Matrices and arrays
To create an array with four elements per row, separate elements with commas (,
) or spaces
a = [1 2 3 4]
MATLAB will execute the above statement and return the following results:
a = 1Ã4
1 2 3 4
#Create a matrix with multiple rows
a = [1 3 5; 2 4 6; 7 8 10]
a = 3Ã3
1 3 5
2 4 6
7 8 10
#5Ã1 column vector of zeros
z = zeros(5,1)
z = 5Ã1
0
0
0
0
0
Comments