【发布时间】:2020-11-21 06:54:50
【问题描述】:
我通过 16 个不同的渠道收集了神经数据。该数据是在 30 秒内记录的。
在 10 秒期间(从 20 到 30 秒),我想记录大于或等于指定阈值的神经数据点的数量。我想按照 0.001s 的 bin 来做。
我正在使用 MATLAB 2019b。
到目前为止,我的代码如下所示:
t1 = 20;
t2 = 30;
ind1 = find(tim_trl>=t1, 1);
ind2 = find(tim_trl>=t2, 1);
time1 = tim_trl(ind1:ind2); %10s window
sampRate = 24414; %sampling freq (Hz), samples per sec
muaWindow = 0.001; %1ms window
binWidth = round(muaWindow*sampRate); %samples per 1ms window
threshold = 0.018;
for jj = 1:16 %ch
data = AbData(ind1:ind2, jj); %10 sec of data
for kk = 1:10000
abDataBin = data(1:binWidth,jj); %data in 1 bin
dataThreshold = find(abDataBin >= threshold); %find data points >= threshold
mua(kk,jj) = sum(dataThreshold); %number of data pts over threshold per ch
end
end
到目前为止,我只是在这一点上遇到了一些麻烦:
abDataBin = data(1:binWidth,jj); %data in 1 bin
当我运行循环时,bin 1 中的数据被覆盖,而不是转移到 bin 2, 3...10000。如有任何有关解决此问题的反馈,我将不胜感激。
非常感谢。
【问题讨论】:
-
欢迎来到本站!要获得帮助,请包含一个可以运行的代码的最小示例(定义所有变量),并定义预期输出
标签: matlab for-loop sliding-window