What I've been trying to do is use Matlab to generate stimulus data and NEURON to generate the excitation data. How the "collaboration" between the two programs works is by Matlab generating data, saving them to a stimulus.txt file, NEURON is called, reads the stimulus.txt file, generates an exchitation.txt, then Matlab reads that and moves on with further calculations.
This works perfect for a single piece of stimulus data.
I want now to make this stimulus data into segments so I can process larger chunks of data without having the computer drink up all the RAM and crash.
My thoughts are since I already setup this Matlab calling NEURON to grab its results, what if I store the neuron state and use that to initialize the neuron parameters within NEURON for the next piece of stimulus data what Matlab with deal with.
To avoid the problem of the first set of data and their initialization I have the file called "init.hoc" which is:
Code: Select all
...
proc initialize(){
t = 0
finitialize(v_init)
fcurrent()
}
...
proc integrate(){
while (t<tstop){
fadvance()
}
}
...
objref svstate
objref f5
proc go(){
initialize()
integrate()
svstate = new SaveState()
f5 = new File()
f5.wopen("neuron_state.dat")
svstate.save()
svstate.fwrite(f5)
}
"batch_run.hoc" look like:
Code: Select all
...
objref ldstate
objref f6
ldstate = new SaveState()
f6 = new File()
f6.ropen("neuron_state.dat")
ldstate.fread(f6, 1)
proc initialize(){
ldstate.restore()
}
...
proc integrate(){
while (t<tstop){
fadvance()
}
}
...
objref f5
objref svstate
proc go(){
initialize()
integrate()
f5 = new File()
svstate = new SaveState()
f5.wopen("neuron_state.dat")
svstate.save()
svstate.fwrite(f5)
}
...
This code doesnt work...
init.hoc works just fine so the saving the state into a file I assume it works ok.
My next step was to try and see if this code:
Code: Select all
proc initialize(){
ldstate.restore()
}
So now I assume the error must be within
Code: Select all
objref ldstate
objref f6
ldstate = new SaveState()
f6 = new File()
f6.ropen("neuron_state.dat")
ldstate.fread(f6, 1)
"Failed assertion
i < prl_->count()
at line 5454 of file
"/home/hines/neuron/nrnrel/src/nrniv/../nrncvode/netcvode.cpp",
in function: PlayRecord* NetCvode::playrec_item(int)
"
which to be honest I don't know how to deal with.
Any help will be greatly appreciated,
Thank you,
Andreas.