Aligning 5 second interval data of continuous time to the same interval
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
I have an array of times at which neurons are firing, spike times, that are all 5 second intervals. However, these intervals are increasing due to the data recording being done at the same time. Is there a way I can zero these five second intervals so that there time stamps are over the same time scale, say 0 to 5 seconds. Basically take 5 second intervals of time stamps from 16-21 seconds or 19-34 and 'zero' them from a 0 to 5 second scale. The attached matrix has an example of time stamps within some five second intervals. The overall goal is to overlay these spike times to look at the firing rate and density etc.
Any help would be greatly appreciated. Please let me know if I need to clear anything up.
채택된 답변
I’m not sure what you want to do. Your data are also not easy for me to interperet, because they lack a time base.
See if something like this works:
d = load('Heath Robinson spks.mat');
spk = d.spk;
for k1 = 1:size(spk,2)
thrsh = mean(spk{k1}(1:5)) + 5*std(spk{k1}(1:5)); % Define Threshold
dep(k1) = find(spk{k1} >= thrsh, 1, 'first'); % Initial Value Exceeding Threshold
end
figure(1)
plot([1:size(spk{1},2)], spk{1}, dep(1),spk{1}(dep(1)), 'r^')
hold on
plot([1:size(spk{2},2)], spk{2}, dep(2),spk{2}(dep(2)), 'r^')
plot([1:size(spk{3},2)], spk{3}, dep(3),spk{3}(dep(3)), 'r^')
hold off
grid
댓글 수: 13
I have binned spike points, 0 for not firing and 1 for firing, along with the time stamp over the entire time window (binspikes)with intervals of start and stop times (intervals), not sure if that would be easier because it gives a time base.
I basically want the the five second intervals all starting relative to each other. These intervals happen periodically over the entire time of recording, but I want them all starting at time 0 relative to the interval start time.
Does this help?
I’m sorry, but I don’t understand your data.
I’ll delete my Answer in a few minutes, since I seriously doubt I’ll be able to help you.
I feel like its not too hard, I am just horrible at explaining it. I think it would be to just subtract the interval start time from the entire interval. So you set the start time to be time 0 and all spike times relevant to that.
The problem is that I have no idea what your data even represent.
The ‘binspikes’ matrix is a (114703x2) which I infer column 1 to be time and column 2 is something else.
The ‘intervals’ is a (3x2) douible matrix with no explanation.
I’m a Board Certified Internal Medicine physician (M.D.) and M.S. biomedical engineer, and I’m doing my best to help, as I do with most biomedical engineering Questions I encounter. But I still have no idea what you want.
My apologies for the confusion. I think I have figured out what I want to do, just do not have the coding experience to do it. The Intervals matrix left column is the start time of a behavior and the right column is the end time. The spks matrix is times of neurons firing that was sorted from a matrix containing all spike times of the neuron firing (spiketimes). Using the following code
if true
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
end
So now all the spike times from the start and stop times of intervals are in a cell array. I would like to take the start time from the left column in the interval and subtract it from every spike time in its cell array. This will make all the interval times relative to 0. So basically for the first array take the first start time and subtract that time from within that cell array, the second from the second cell array etc.
I’ve been experimenting on and off with this for the past few days, and I still have no idea what you want to do.
It would probably help (if you feel comfortable discussing it here on MATLAB Answers) to describe your study, what data you collected, and what you want to demonstrate. I can’t figure it out from what you’ve written thus far.
Is it possible to just take the number in the right column and substract it from the entire cell array that it correlates with? The first row correlates with the first cell array, the second the second cell array and so forth?
If not I can go in more detail.
I’m not sure what to do with ‘spiketimes’. I assume from your most recent Comment you want to do something with ‘spk’ and ‘intervals’.
With this code:
d1 = load('Heath Robinson spiketimes.mat');
spkt = d1.spiketimes;
d2 = load('Heath Robinson spks.mat');
spk = d2.spk
d3 = load('Heath Robinson intervals.mat');
intvl = d3.intervals
This is what they return:
spk =
[1x84 double] [1x322 double] [1x140 double]
intvl =
60.1680e+000 65.1680e+000
88.2780e+000 93.2780e+000
105.5881e+000 110.5881e+000
What do you want to do with them?
The three spk matrices in the array correspond to each interval. So for the first matrix take the start time, 60.1680 and subtract it from every data point within the 1x84 double. The next start time 88.2780 and subtract it from the 1x322 double. 105.5881 from the 1x140 double.
I have to return them as a cell because their lengths aren’t equal:
out = {spk{1}'-intvl(1,1), spk{2}'-intvl(2,1), spk{3}'-intvl(3,1)};
This seems to be what you described.
Thank you! I can pad them once they are in cells, but thank you!
My pleasure!
Could you put the code from "out" a way that could do it to more than just three sets of spikes and intervals?
I posted it as a question here:
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Electrophysiology에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
