data written yields empty dataset

Anything that doesn't fit elsewhere.
Post Reply
lb5999
Posts: 56
Joined: Mon Oct 11, 2010 9:12 am

data written yields empty dataset

Post by lb5999 » Sun Jan 29, 2012 10:34 am

Hi Ted,

I have a vector of voltage clamp values being written to a matrix M, for varying a particular conductance parameter gkabar_borgka. The vector of these parameter values are also written to M. I then print this matrix M to a dataset, trouble is, the dataset is empty! The matrix contains elements though, as can be seen by the M.x[.][.] command. What medial bug have I got?

Code: Select all

// Simulations which record the required injected current to hold the cell at -55mV, for varying values of GKABAR.

load_file("Cell.hoc")

// Ensure we are working on WKY model:

SPNcells[0].soma.zetak_borgka=-5
SPNcells[0].soma.zetam_borgka=4
SPNcells[0].soma.gkabar_borgka=0.005

tstop=500

proc init() {
finitialize(-55)
/*
if (cvode.active()) {
cvode.re_init()
} else {fcurrent()
}
frecord_init()
*/
}

objectvar clamp
clamp=new VClamp(0.5)
clamp.amp[0]=-55
clamp.dur[0]=5000

ngka=3

objectvar clamprec, gkabarrec
clamprec=new Vector(ngka)
gkabarrec=new Vector(ngka)

for i=0, ngka-1 {

gkabar_borgka=0.004-(i*0.00005)

run()

print i

clamprec.x[i]=clamp.i
gkabarrec.x[i]=gkabar_borgka
}

objectvar M
M=new Matrix(ngka,2)

objectvar DataV
DataV=new File()

M.setcol(0,gkabarrec)
M.setcol(1,clamprec)

DataV.wopen("Injected_Current_Amplitudes_29Jan12.dat")

M.fprint(DataV, " %g")
Thanks,

Linford

lb5999
Posts: 56
Joined: Mon Oct 11, 2010 9:12 am

Re: data written yields empty dataset

Post by lb5999 » Sun Jan 29, 2012 11:00 am

Also, Ted, I would like to then refer to the current values that the above script writes to a dataset, in numerous other .hoc files. So, I will want to import this data set (this seems more sensical than running this current clamp script everytime I run one of these aforementioned .hoc files). How do I go about doing this? I thought the answer would be to create a new file object, and use ropen, and then vread/fread to read the data into a vector.. am I barking up the wrong tree here?

Thanks,

Linford

ted
Site Admin
Posts: 5567
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: data written yields empty dataset

Post by ted » Sun Jan 29, 2012 12:46 pm

lb5999 wrote:the dataset is empty!
The file is created but nothing is actually written to it until you do one of these three things:
exit NEURON
destroy the file object
explicitly close the file

ted
Site Admin
Posts: 5567
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: data written yields empty dataset

Post by ted » Sun Jan 29, 2012 12:47 pm

lb5999 wrote:create a new file object, and use ropen, and then vread/fread to read the data into a vector
True.

Post Reply