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!


1 Answer 1

% 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) = [];
  • $\begingroup$ 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. $\endgroup$
    – Haider
    Oct 16, 2015 at 11:14
  • 1
    $\begingroup$ I edited my answer for you. These are basic MATLAB operations. $\endgroup$ Oct 16, 2015 at 11:39
  • $\begingroup$ .Thanks for your response .I will try it out in my algorithm and see how it works.Thanks again. $\endgroup$
    – Haider
    Oct 16, 2015 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.