Defining an EPSP window

조회 수: 30 (최근 30일)
AMC3011
AMC3011 2021년 3월 16일
편집: AMC3011 2021년 3월 19일
Hi, I was wondering if someone could help me out on this one:
I have a recording with 2 action potentials one after the other stimulated at different points. The thing is I only want the data for the first one but I cant seem to get my head around extracting the time window which includes the fEPSP I want from the whole plot.
num_samp = size(Data.S{1,1});
Interval = Data.t_interval
t= 0:Interval:(num_samp-1)*Interval;
t = t'*1000;
Record = plot(t, Data.S{1,1});
This is the code im currently using to plot the whole set of recordings but I would like to have the ones between 10ms and 45ms only.
Hope you can help me, if more information is needed I am happy to supply it.
Thanks in advance.

채택된 답변

Tarunbir Gambhir
Tarunbir Gambhir 2021년 3월 19일
You could search for the start and end indices in the time vector and use that to plot the data within that interval.
You could try something like this:
data = Data.S{1,1};
num_samp = size(data);
Interval = Data.t_interval;
t= 0:Interval:(num_samp-1)*Interval;
t = t'*1000;
startI = find(t==10); % assuming the time is in ns
endI = find(t==45);
Record = plot(t(startI:endI), data(startI:endI));
  댓글 수: 5
Tarunbir Gambhir
Tarunbir Gambhir 2021년 3월 19일
Thanks for sharing the data. I see that the problem arises because the time vector "t" would not necessarily have a value equal to 10 or 45 in this case.
I modified the last 3 lines of code and you should see the desired results with this:
[~,startI] = min(abs(t-10));
[~,endI] = min(abs(t-45));
Record = plot(t(startI:endI), data(startI:endI,:));
AMC3011
AMC3011 2021년 3월 19일
Hugely appreciated, that does exactly the job!
Thanks and kind regards.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Debugging and Analysis에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by