# Applying a window to input signal

I am sorry if I say any thing silly .Please forgive me.I want to apply a window to input signals.I have two signals each of which contains zeros (462 samples) and non zeros data (38 samples).I want my window to take only the non zeros data (or data above certain threshold).My ultimate goal is to reduce the processing time and resources by taking only non zero data .I will use this data in finding cross correlation and finally the delay between those signals.Can any one comment How I can do that (some hints about matlab code). Thanks in advance and I am sorry for any inconvenience!

% copy and paste into matlab command line

% say you vector is this:

a = randn(100, 1);

% you take out these small values:
threshold = 0.3;
a = a(abs(a) > threshold); % or try a(abs(a)<threshold) = [];

• Thanks for your response.Here the threshold (in your code ) is 0 .But if I want to set a non zero value as threshold (signal may contain small noise in it).In that case how should apply the conditions. I want to take values which are greater than certain threshold .I am sorry I could not explain it in my original question.Please forgive me. I hope you get my point. – Haider Oct 16 '15 at 11:14
• I edited my answer for you. These are basic MATLAB operations. – Nir Regev Oct 16 '15 at 11:39
• .Thanks for your response .I will try it out in my algorithm and see how it works.Thanks again. – Haider Oct 16 '15 at 14:38