I need to automatically (through a Gui) save results of simulation. In this case, I need to save as a text file , a vector which is teh second derivative of an action potential against the time.

I wrote this code which is launched after a compete run :

Code: Select all

```
// create objects to put Vectors : "spike": time course of v at soma, "deriv_1" : i-cap at the soma (first derivative of v)
objref icvec, d2, tvec, g2, fdv2
icvec = new Vector()
soma icvec.record(&i_cap(0.5)) // filling the object "icvec" with i_cap at the soma (0.5) you may change
// it to get i-cap where you like
// d2 will contain derivative of i_cap, g2 will plot that vs.time
d2 = new Vector()
tvec= new Vector()
fdv2= new File() // File to save vectors
tvec.record(&t) // I record the time
proc postprocess() { // creation of a procedure called postprocess that calculate the dev of icvec and fill a file
d2.deriv(icvec, dt)
g2 = new Graph(0)
d2.plot(g2, dt) // plot of d2 vs t
g2.size(-0.5,0.5,-15,15)
g2.view(-0.5, -15, 1, 30, 648, 296, 400.48, 300.32)
g2.label(0.05, 0.9, "x: t", 2, 1, 0, 0, 2)
g2.label(0.05, 0.75, "y: deriv_2", 2, 1, 0, 0, 3)
g2.exec_menu("View = plot") // to autoscale the graph
fdv2.wopen("dv2.csv") // a file called dv2.csv will be created
tvec.printf(fdv2)
d2.printf(fdv2) // actually I want a file with two columns: the time and the dv2
fdv2.close()
}
//create a panel for launching analysis
{xpanel("analyse",1)
xbutton("analyze and save dV2 ", "postprocess()")
xpanel()
}
```

Thanks a lot

Fabien