MATLAB Answers

Problem in applying loop

1 view (last 30 days)
Ali Asghar
Ali Asghar on 7 Aug 2019
Commented: Star Strider on 11 Aug 2019
I want to apply loop in a way that there is a window of 2000 samples and will increment by 500 samples...
means window size (w) increase like: 0-2000, 2500-4500, 5000-7000, 7500-9500....till 30000.
then the window (w) apply in same way on data (x) like = 0-2000, 2500-4000 etc...
how can i do this?
x = dath001 % data, size 30000x4
w = hann(2000); % window
datawindow = w.*x(1:2000,:); % apply window in data


Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 7 Aug 2019
You have the Signal Processing Toolbox, so see if the buffer function will do what you want.


Show 2 older comments
Star Strider
Star Strider on 10 Aug 2019
You do not need a loop. Just create column vectors from the individual ‘datawindow’ results, and concatenate them horizontally.
This will probably work:
datawindow = [datawindow1(:), datawindow2(:), datawindow3(:), datawindow4(:)];
I do not have your data, so I cannot test it with them.
Ali Asghar
Ali Asghar on 11 Aug 2019
Thanks alot dear....
Star Strider
Star Strider on 11 Aug 2019
As always, my pleasure.

Sign in to comment.

More Answers (0)