MATLAB: How can i add row to matrix like

MATLABmatrix

how can i add row to matrix like
a =
1 0 3
3 4 5
7 5 2
And I want to add new row between the first row and second row....new row is 0 1 2
and make it look like this
a =
1 0 3
0 1 2
3 4 5
7 5 2

Best Answer

>> a = [1,0,3;3,4,5;7,5,2];
method one: concatenation of submatrices:
>> b = [a(1,:);[0,1,2];a(2:3,:)]
b =
1 0 3
0 1 2
3 4 5
7 5 2
method two: indexing into matrix:
>> b = a([1,1:3],:);
>> b(2,:) = [0,1,2]
b =
1 0 3
0 1 2
3 4 5
7 5 2