Look at
for i=1:(N)
if (alpha*DELTA_t)/(DELTA_x^2)<=0.5
T(i,j+1)=T(i,j)+((alpha*DELTA_t)/((DELTA_x)^2))*(T(i+1,j)-2*T(i,j)+T(i-1,j));
end
You have a term T(i-1,j). When i is 1 this would be T(0,j), but Matlab indices must start at 1, not 0.