If you want the complete time course of membrane potential, use the Vector class's record() method to capture membrane potential at a particular location to a Vector. Example:
- Code: Select all
// these statements only need to be executed once
// a good time to do this would be immediately after the model specification code
// i.e. the statements that set up the topology, geometry, and biophysics of the model
objref vvec, tvec
tvec = new Vector()
tvec.record(&t) // record time
vvec = new Vector()
axon vvec.record(&v(1)) // record v at 1 end of axon
If you only need spike times, the best thing to do is to use the NetCon class's record() method to capture spike times to a Vector. For an example, see the Programmer's Reference documentation of the NetCon class; as with Vector recording, this only has to be done once in a program, and an appropriate place for these statements would be right after the model specification has been executed.
In either case, after a simulation you just write the contents of the Vector to a file (see documentation of the Vector and File classes). If you're going to { run, then save results } many times, you might want to create your own procedure to automate this task, e.g.
- Code: Select all
proc myrun() {
run() // launches a simulation
saveresults()
}
run() is part of NEURON's standard run system. saveresults() is your own procedure that you wrote to open a file, write results to it, and close the file and can be as fancy as you like--most convenient would be if it automatically creates a different file name each time it is called.