I have a dataset of 3 recorded vectors - vrec[0], vrec[1] and vrec[2] and a timestep vector vdt. The recorded vectors show the response of my cell to a brief depolarising pulse, causing a single action potential, and have been truncated using vrec.remove() to leave only the trough and following afterhyperpolarisation (AHP).
I want to create a new vector 'AHP', of length 3, where the ith entry is the time it takes for vrec to increase to 66% of its depth, i.e. AHP.x will be some measure of how long the AHP is in vector vrec.
I have tried to cook up some HOC code which does this (pasted below) but it keeps giving AHP.x=2000 for i=0,1,2. Can anyone point me in the right direction please? I feel like I am barking up the wrong tree by using all these if commands.
Code: Select all
for i=0,2 {vrec[i].remove(0,41119)}
vdt.remove(0,41119)
// objectvar H
// H=new Matrix(vrec[0].size(),4)
// for i=0,2 {H.setcol(i+1,vrec[i])}
// H.setcol(0,vdt)
// objectvar DataH
// DataH=new File()
// DataH.wopen("test.dat")
// H.fprint(DataH, " %g")
objectvar zetak
zetak=new Vector(41)
zetak.indgen(-6,-4,0.05) // Fill vector with elements in increments of 0.05 between and including -6 and -4.
objectvar AHP
AHP=new Vector(3)
for i=0, 2 // Cycles through each recorded vector
{for j=0, vrec[0].size() // each recorded vector is the same length - cycles through each element of the vector.
{
if (vrec[i].x[j]=vrec[i].min()-(2/3)*(vrec[i].min()-RMP.x[i]) // I believe this statment says: if the jth element of vrec[i] is such that it equals 66% of the height of the AHP, then...
{AHP.x[i]=vdt.x[j]-vdt.x[???]} else {AHP.x[i]=0} // ... set the ith element of AHP to the time at which this happens MINUS the time at which the trough of the AHP starts. Else set the ith element of AHP to 0 (this should never happen).
}
}