How translate script from matlab to use it in igor pro?

Hi,
I'm completely new to Igor Pro I use to work with Matlab but once I used igor I love it.
My problem is probably trivial for most of you but not for me. My output from Monte Carlo sim is plotted in fig A
in matlab I use the following loop to get useful plot like in fig B

averagesviral=zeros(length(data2),1);
averagesviral(1)=data2(1);
for i=1:length(data1)-1;
averagesviral(i+1)=((averagesviral(i)*i+data2(i+1))/(i+1));
end

How to do similar operation in Igor Pro?
Thanks a lot.
I don't really know Matlab but this looks like:

Make/O /N=(numpnts(data2)) averagesviral=0
averagesviral[0]=data2[0]
averagesviral[1,]=(averagesviral[p-1]*(p-1)+data2[p])/(p)


A.G.
WaveMetrics, Inc.