MATLAB: Creating new matrix from existing one

creating matrix form existing one

I wanted to use script to create a new matrix from existing one. The first row of the new matrix equals to the first row of the existing matrix and the second column except for entry (1,2)equals to the negative of that column of the existing matrix.And remaining entries be what described in the script. I get error message that : Unable to convert expression into double array. Error script (line 8) a(i,j)=m(i,j). Please help me find out what's going wrong with my code. Thanks you!
clear
syms n v pj pk d
m=[1-d^2,1,(1-d)*d,d,-d,1;d*(1-d),d,(1-d^2),1,-d,1;-(1-d)*n,-v-pj,-(1-d)*n,-v-pk,v+pj+pk,0]
a=zeros(3,6)
for i=1:3,
for j=1:6
if i==1
a(i,j)=m(i,j)
elseif i~=1&j==2
a(i,j)=-m(i,j);
else
a(i,j)=m(i,j)-(m(1,j)*m(i,2))/a(1,2);
end
end
end

Best Answer

I finally figure out how to do it. I deleted a=zeros(3,6) from the lines and it worked perfectly. It seems that the digit type generated by zeros is different from matrix m.