How do I create a sliding window and/or bin that records the number of elements over a given time period
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have neural data collected across 16 different channels (2d matrix = 756909 x 16). This data was recorded over a 30 second period (2d matrix 1 x 756909).
For each channel, I have calculated an amplitude threshold (2d matrix 1 x 16).
Over a 10s period (from 20 - 30s), I want to record the number of neural data points that are greater than or equal to the corresponding threshold for each channel. I would like to do this in windows (or bins) of 0.001s.
My code so far is still very deficient but looks like this:
t1 = 20; %start time, seconds
t2 = 30; %end time, seconds
time = tim_trl(tim_trl>=t1 & tim_trl<=t2); %10s window
for ii = 1:16
for jj = t1:0.001:size(time,2)
end
end
I would appreciate any help or advice.
2 commentaires
dpb
le 25 Juil 2020
Is this fixed sample time and if so, what is the actual sampling rate?
IF the data are in fact collected over exactly 30 sec, we can compute what the sampling rate is but if the 30 sec is just an approximation of how long 756909 samples is as the sampling rate is 40 usec instead of 39.6349... usec, that's a different story.
Or, if it's just polled sampling and the the sampling rate is just about 40 usec, that's something different yet.
Need the groundrules strictly defined first, then it'll be straightforward to answer the questions wanted.
Réponse acceptée
Matt J
le 25 Juil 2020
Modifié(e) : Matt J
le 25 Juil 2020
t1 = 20; %start time, seconds
t2 = 30; %end time, seconds
win=tim_trl>=t1 & tim_trl<=t2;
time = tim_trl(win); %10s window
edges=time(1):0.001:time(end)+0.001;
bins=discretize(time,edges);
result=splitapply(@(z)sum(z,1), neuralData(win,:) >= thresholds ,findgroups(bins(:)))
3 commentaires
Matt J
le 26 Juil 2020
You're welcome, but please Accept-click the answer to indicate that it solved your problem.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Pulsed Waveforms dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!