Page 1 of 1

proccesing vector data

Posted: Tue Nov 07, 2006 10:41 pm
by okanerkaymaz
Hi, Friends

i have a problem vector object
my code s folowing;

Code: Select all

objref data,dat1,f
data=new Vector()
f=new File()
f.aopen("ss.dat") 
data1=new Vector()
data.record(&soma.v(0.5))
data1.record(&t)
for (i=0:data.x[i]>=4) { f.printf("%f\n",data1.x[i]) f.close()
                        break
                      }


                                         }

my ss.dat file doesn't a variable and

when i write "print data.x[45]" in console, i don't variable and i have a error message that is "subscript out of range x"

You think where is error ? and also
is there anyway using variables of vector in neuron?

if you write code part , i will happy

just Now , thanks for your answers

best regard

Posted: Wed Nov 08, 2006 10:48 am
by ted
Read this https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=674
Then try debugging it yourself.

Posted: Wed Nov 08, 2006 1:25 pm
by okanerkaymaz
Dear Ted
i notice my wrong , i changed my code
i haven't writen my codes in forum but it was truth in my hoc file
this code isn't run

my problem is vector using but i read references
of programmers
i don't know how will i access recorded variables into my vector

forexample
when i wrote like folowing codes, it didn't run

Code: Select all

vector.record(&soma.v(.5))
print vector.x[5]
However when i wrote like folowing codes, it runs

Code: Select all

vector.append(0.1,0.23,0.012,5.4)
print vector.x[3]
0.012
Best regard

Posted: Wed Nov 08, 2006 4:22 pm
by ted
According to the Programmer's Reference article about Vector record(),
vdest.record(&var)
saves "the stream of values of "var" during a simulation into the vdest vector".
It also says that
"Transfers take place on exit from finitialize() and on exit from fadvance()."
and it contains a link to the documentation of fadvance, which says
"fadvance integrates the equation over the dt step".
Finally, the provided example is

Code: Select all

objref dv
dv = new Vector()
dv.record(&terminal.v(.5))
init()	// or push the "Init and Run" button on the control panel
run()
In other words, nothing is recorded to vdest until you run a simulation.
If you run a simulation first, and then execute vdest.record(&var), vdest will be empty.