MATLAB: How to perform the following operation in matrix

MATLABmatrixvector

A=[2 3 4 5; 4 5 6 7; 3 4 5 6; 3 4 2 1] to get matrix B=[ 2 3 4 5; 4 20 18 7; 3 16 15 6; 3 4 2 1] the outer number remain as it was while the inner element is multiplied by the first row starting by the first element from the end. Matrix A is a square matrix of n dimensions. This is what I have tried so far
[m, n] = size(A); A= double(A);
for i=1:m
for j=1:n
if (j==1 && i==1)
B(i,j)= A(i,j);
elseif (i ==m && j==n)
B(i,j)= A(i,j);
else
B(i,j)= A(i,j+1) * A(i-1,n-j);
end
end
end

Best Answer

If I understand correctly
>> A=[2 3 4 5; 4 5 6 7; 3 4 5 6; 3 4 2 1]
A =
2 3 4 5
4 5 6 7
3 4 5 6
3 4 2 1
>> B=A
B =
2 3 4 5
4 5 6 7
3 4 5 6
3 4 2 1
>> B(2:end-1,2:end-1)=B(2:end-1,2:end-1).*B(1,end-1:-1:2)
B =
2 3 4 5
4 20 18 7
3 16 15 6
3 4 2 1