indexing in for loop

1 回表示 (過去 30 日間)
Mary Hemler
Mary Hemler 2020 年 6 月 2 日
コメント済み: madhan ravi 2020 年 6 月 2 日
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 件のコメント
madhan ravi
madhan ravi 2020 年 6 月 2 日
Can you post the missing datas?

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2020 年 6 月 2 日
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

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTime Series についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by