# MATLAB: Looping Through and Writing into Matrix

averagefor looploopmatrix

I'm trying to solve a problem I think it simple but don't seem to get how to do it in Matlab. My other option would be to use MathCad to figure it out.
I have a time series that I want to take the FFT of over various chunks. I want to automate the sequence so I don't have to write n identical command lines for it. Let's say the times series is called SING. I can write:
n=1024fft1=fft(SING(1:1024),n)/n
The next sets would be
fft2=fft(Sing(1025:2048),n)/nfft3=fft(Sing(2049:3072),n)/n
etc…
How to I loop things so that I get 3 fft vectors spit out by using a for-loop or some other loop?
Then I want each one of those fft vectors to go into one matrix or be able to automate their average without having to create that matrix myself by appending one vector to another?
Any bit will help. Thanks.

x = randn(16384,1);S = spectrogram(x,1024,0,1024);
x = rand(16384,1);x = reshape(x,1024,16);xdft = fft(x);