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개)

KSSV
KSSV 2020년 6월 2일

0 개 추천

iwant = cellspikes(48:71)

댓글 수: 1

Mary Hemler
Mary Hemler 2020년 6월 2일
I don't think that will work, because then the values of idx don't line up with the correct values in iwant

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2020년 6월 2일

댓글:

2020년 6월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by