Lets say you have 2 signals of length N and M.The correlation of those 2 signals will have a length (N + M + 1).What windowing does is essentially just crops the signal, but the cropping is from the centre.So if I wanted a window length of K, I would just take the K samples in the middle of the (N + M + 1) length correlated signal.
If for example you cross-correlated two 100-sample long signals and wanted to implement a window length of 160, you would get the cross correlation which would yield a 201 sample long signal and would get the 160 samples in the middle of the cross correlation signal, i.e knock out 20 samples from beginning of the signal and 21 samples from the end of the signal.
Now, lets proceed to delay detection.If I understand you correct you have 2 signals, but one signal is just a delayed version of the other one and you want to estimate what that delay is, is that right?
What you want to do in this case is compute the cross correlation of the 2 signals (with maxlags = 0 ) and find where the cross correlated signal is maximum, the distance between the point where the signal is maximum and the midpoint of cross correlated signal gives you the delay of the signal ( in number of samples, the actual delay in seconds will depend on how many seconds those samples represent ).
Hope I made things clear
[c,lags]=xcorr(x,y,maxlags)wheremaxlagsis the number of elements of the longer of your two vectors (i.e.max(numel(x),numel(y))? - Danxcorrdocs, you'll see that (a) it handles the zero padding for you and (b) that the optionalmaxlagsargument makes it find the correlation for all the lags in the series-maxlag:maxlags. Read the docs: mathworks.com/help/signal/ref/xcorr.html, they should clarify things - Dan