for i=1:10 for j=1:10 if 8<=i<=10&&8<=j<=10 DM(i,j)=D(i-7,j-7); else DM(i,j)=0; end end end Attempted to access D(-6,-6); index must be a positive integer or logical. Error in Untitled2 (line 4) DM(i,j)=D(i-7,j-7); 当if为假的时候不就不执行后面的语句了吗?怎么好像它还要执行。D是一个3*3矩阵