MATLAB: Help with hadamard matrix

hadamard matrix

i have Hadamard matrix
N=8;
H=hadamard(N)
>>H =
1 1 1 1 1 1 1 1
1 -1 1 -1 1 -1 1 -1
1 1 -1 -1 1 1 -1 -1
1 -1 -1 1 1 -1 -1 1
1 1 1 1 -1 -1 -1 -1
1 -1 1 -1 -1 1 -1 1
1 1 -1 -1 -1 -1 1 1
1 -1 -1 1 -1 1 1 -1
i want to keep the same values of the first and the last column and the first row and change the others like this
H =
1 1 1 1 1 1 1 1
1 a a -a a -a a -1
1 a -a -a a a -a -1
1 -a -a a a -a -a 1
1 a a a -a -a -a -1
1 -a a -a -a a -a 1
1 a -a -a -a -a a 1
1 -a -a a -a a a -1

Best Answer

H=hadamard(8);
a=10
H(2:end,2:end-1)=a*sign(H(2:end,2:end-1))
%or simply
H(2:end,2:end-1)=a*H(2:end,2:end-1)