MATLAB: Repeat Lines 14 to 25 a specified number of times, only print final matrix

iterationmatrixprint

I'm really new to matlab. How would I go about getting this to repeat from line 14 to 25 a certain number of times (iterate) for instance 131 times. I don't want it to print the result at each iteration just the resulting matrix after 131 iterations.
clear;
HOLD=zeros(23,23);
HNEW=zeros(23,23);
R=zeros(23,23);
%Initial Value of matrix
for i=1:23
for j=1:23
HOLD(i,j)=10
HNEW(i,j)=10
end
end
R(22,2)=-0.2;
%implement implicit method
for i=2:22
for j=2:22
H1=0.25*(HOLD(i,j+1)+HOLD(i,j-1)+HOLD(i-1,j)+HOLD(i-1,j-1))
H2=0.25*(HNEW(i,j+1)+HNEW(i,j-1)+HNEW(i-1,j)+HNEW(i-1,j-1))
HNEW(i,j)=(1/((100*100*0.002/4/300/0.1)+1))*(H2+100*100*0.002/4/300/0.1*HOLD(i,j)+100*100*R(i,j)/4/300)
end
end
for i=2:22
for j=2:22
HOLD(i,j)=HNEW(i,j)
end
end
%No Flow Boundarys
for j=1:23
HOLD(1,:)=HOLD(3,:)
HOLD(23,:)=HOLD(21,:)
end
for i=1:23
HOLD(:,1)=HOLD(:,3)
HOLD(:,23)=HOLD(:,21)
end
%Need to repeat from line 14 a specified number of times.

Best Answer

for RepeatNumber = 1 : 131
.... code ...
end
Related Question