필터 지우기
필터 지우기

Taking data points in between multiple interval times times and outputting them in separate structural arrays

조회 수: 1 (최근 30일)
I have spike times in one matrix. I then have time intervals, start and stop times, that I would like to get all the spike times in between. I believe I could use bsxfun and @ge function to do this, but I would like to have each interval of extracted spikes time outputted into separate structural arrays. The field names do not matter for the structural array and can be the same. I think I can use the struct function, but I have had issues on how to use these two functions in the way I want.
To sum, I have intervals, Start time and Stop time, in one matrix (intervals) and I want to get corresponding spike times (spiketimes) from each interval of another matrix and output them into individual structural arrays for each interval. I have attached example matrices of what the two matrices look like.

채택된 답변

John BG
John BG 2016년 6월 11일
Heath
spiketimes=spiketimes' % just to visualise horizontally
[sz1_intervals sz2_intervals]=size(intervals)
% init containers of variable length for found spikes within each interval
for k=1:1:sz1_intervals
spk{k}={}
end
for k=1:1:sz1_intervals
w=intervals(k,:);
spk{k}=intersect(spiketimes(find(spiketimes>=w(1))),spiketimes(find(spiketimes<=w(2))));
end
each group of spikes is contained in respective cells:
spk{1}
=
=
Columns 1 through 5
60.18 60.18 60.18 60.18 60.18
Columns 6 through 10
60.18 60.19 60.19 60.19 60.19
..
64.93 64.93 64.94 64.94 65.02
Columns 81 through 84
65.02 65.02 65.04 65.05
spk{2}=
..
spk{3}=
..
If you find this answer of any help solving your question,
please mark this answer as accepted,
thanks in advance
John

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by