Load a value located in a text file

Anything that doesn't fit elsewhere.
Post Reply
freddy09
Posts: 17
Joined: Tue Mar 18, 2008 6:06 am
Location: LIRMM

Load a value located in a text file

Post by freddy09 »

Hi !!
I try to load in one electrode an amplitude which is written in a text file with NEURON.
How can i make it?
ted
Site Admin
Posts: 6384
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

See this item which I have just added to the Hot tips area of this Forum:
How to read numerical values from a file
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=1265
freddy09
Posts: 17
Joined: Tue Mar 18, 2008 6:06 am
Location: LIRMM

Post by freddy09 »

I made one program, but it didn't work

Code: Select all

//begin.hoc
load_file("nrngui.hoc")
load_file("window_value.ses")

//window_value.ses
proc load() {xopen("loading.ses")}
{
xpanel("Loaded Value", 0)
xbutton("Load","load()")
xpanel(500,600)
}

//loading.ses
objref minfvec, vvec
clipboard_retrieve("na_m.inf")
minfvec = hoc_obj_[0]
vvec = hoc_obj_[1]

print "first value ", minfvec
print "second value ", vvec
It write only vector[3] or anything else but it didn't load the value
ted
Site Admin
Posts: 6384
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

To figure out how to print the contents of a Vector, see the Programmer's Reference
documentation about the Vector class's methods.
freddy09
Posts: 17
Joined: Tue Mar 18, 2008 6:06 am
Location: LIRMM

Post by freddy09 »

Hi!!
I load the value located in the file with success. But i can't affect this value to the electrode. There is a syntax error according the simulator.
This is a part of my program, if you want, i can send you my project.

Code: Select all

//recuperation.ses
objref minfvec, vvec
amp_electrode = 0

minfvec = new Vector()
vvec = new Vector()

clipboard_retrieve("na_m.inf")
minfvec = hoc_obj_[0]
vvec = hoc_obj_[1]

minfvec.printf
vvec.printf

for i=0, minfvec.size - 1{	amp_electrode = minfvec.get(i)
			print"l'amplitude vaut ", amp_electrode
			xopen("process.ses")}

//process.ses
{load_file("nrngui.hoc")}
objectvar save_window_, rvp_
objectvar scene_vector_[6]
objectvar ocbox_, ocbox_list_, scene_, scene_list_
{ocbox_list_ = new List()  scene_list_ = new List()}
{pwman_place(0,0,0)}

load_file("electrod.hoc")
ocbox_=new Electrode(0)
execute("can_locate=1 sec=\"node[0]\" xloc=0.15 locate(0)", ocbox_)
execute("vc.dur[0]=0 vc.amp[0] = amp_electrode", ocbox_)
execute("vc.dur[1]=0 vc.amp[1]=0", ocbox_)
execute("vc.dur[2]=0 vc.amp[2]=0", ocbox_)
execute("stim.del=0 stim.dur=0 stim.amp=0", ocbox_)
execute("vcsteps=0", ocbox_)
execute("samp=stim.amp  store_vclamp() glyph()", ocbox_)
ocbox_ = ocbox_.v1
ocbox_.map("Electrode", 1086+20*i, 318, 210, 327)
objectvar scene_vector_[1]
{doNotify()}

Post Reply