indexing in for loop
1 次查看(过去 30 天)
显示 更早的评论
I would like to run a for loop through only variables in certain index positions. Here is my code:
j=1;
for c=48:73 % this is where the problem is
if idx(c)
continue
end
spikes = cellspikes{c};
spikes = spikes(spikes > startTime & spikes < stopTime);
if length(spikes) >= 1000
edgesT = linspace(startTime,stopTime,numel(trackingtimes)+1);
binnedSpikes = histcounts(spikes,edgesT);
binnedSpikes = smoothdata(binnedSpikes,2,'gaussian',50);
pcaBinnedSpikes(j,:) = zscore(binnedSpikes);
j = j+1;
end
end
I would like to only access the elements of cellspikes that are in positions 48 - 71, but my current code is not doing that, because it is showing c as having 72 values, when I only want it to have 25 elements.
How could I access and save only the elements of cellspikes that are in index position 48-71?
Thanks!
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!