Converting Matlab code to python . IndexError: index -1 is out of bounds for axis 0 with size 0 Matlab ++++++
for i = 1:N
for j=1:N
s = zeros(L2,L2);
sX = zeros(L2,L2);
sSS= Y((i-1)*L2+1:i*L2,(j-1)*L2+1:j*L2);
BI{i,j} = sSS;
Python ++++++
for i in range(N):
for j in range(N):
s = zeros(N, N);
sX = zeros(N,N);
sSS =Y[arange(dot((i - 1),L2) + 1,dot(i,L2)),arange(dot((j - 1),L2) + 1,dot(j,L2))]
BI [i,j] = sSS
IndexError: index -1 is out of bounds for axis 0 with size 0. According to the line of BI [i,j] = sSS. The index difference between matlab and python. Matlab starts index 1 and Python starts index 0.