MATLAB Answers

Implementing a "moving window" on an array and selecting values preceding each window

2 views (last 30 days)
Kevin Akash Rajasekaran
Kevin Akash Rajasekaran on 12 Jul 2021
Hey all! I have an array which I will call as "spiketimes''. It's essentially an array consisitng of time points, from ~0.1 secs to ~4.5 secs. Now I have another array called "eyetimes", also consisting of time points. What I ultimately want to do is to select values of the "eyetimes" array based on the values of the "spiketimes" array and how I want to go about this is to implement a "moving window" of sorts.
For eg, the first window will take a window of 0.2 secs in the "spiketime" array from the start (0.0 secs) till about 0.2 secs. Based on this selection, I need to select the value of the "eyetimes" array right before this window.
The second window will now offset the starting point by 0.05 secs such that the starting point will now be at 0.05 secs and the end point will be at 0.25 secs, while keeping the same interval of 0.2 secs. Again I need to select the value of "eyetimes" before the start of the second window.
Likewise, the third window will start at 0.1 secs and end at 0.3 secs and so on...
This continues till the end of the array contents, offsetting the start of the window by 0.05 secs, while still maintaining the interval of 0.2 secs. What might be the best way to go about this? Thanks in advance!
Edited: attached .mat files for both "spiketimes" and "eyetime"
  7 Comments
Kevin Akash Rajasekaran
Kevin Akash Rajasekaran on 12 Jul 2021
A spike event happens at a particular time point and is stored in the spike times array. Preceding this particular time point is an eye time event stored in the eye times array. The catch is that not all eye time points leads to a spike event. Hence the reason for selecting eye times based on spike times. Hope this helps!

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!