Page 1 of 1

vector.min()

Posted: Wed Oct 24, 2007 9:42 am
by Gannier
Hi all!

using the function vec.min() give me an error

in documentation, you can use
x = vec.min()
or x = vec.min(start, end)

I suppose start and end are the index of the values between the search is done

the followed code work

Code: Select all

objref rec
rec.record(&soma.ina_INaf( 0.5 ), 0.01)
x = rec.min()
but changing by

Code: Select all

x = rec.min(1000, 1100)
give me the following error
nrniv: Arg out of range in user function
in fig2IV.hoc near line 38
}
^
Vector[3].max(10001100 , )
is this function buggy or I don't use it correctly ?

Posted: Wed Oct 24, 2007 11:53 am
by ted
The error message means that you asked min() to check elements that don't exist. This
implies that your Vector has fewer than 1001 elements (remember that the index of the first
element in a Vector is 0). Type
vector.size()
at the oc> prompt to discover the Vector's actual size.

Posted: Thu Oct 25, 2007 6:24 am
by Gannier
Hello Ted!

Code: Select all

objref rec 
rec = new Vector() 
rec.record(&soma.ina_INaf( 0.5 ), 0.01) 
x = rec.min()
rec.size() give me 1
but the value x I get is between 1000 and 1500 ms (don't know in points)

this doesn't work with x = rec.min(1000, 1100)

Posted: Thu Oct 25, 2007 9:51 am
by ted
Quoting from the documentation of the Vector class's record() method:
Save the stream of values of "var" during a simulation into the vdest vector. Previous record and play specifications of this Vector (if any) are destroyed.

Details: Transfers take place on exit from finitialize() and on exit from fadvance(). . . .
(see http://www.neuron.yale.edu/neuron/stati ... tml#record
).
In other words, you have to actually run a simulation in order for numerical values to be
recorded to the Vector. The final size of the Vector will be 1 + number of fadvances (if dt is
constant, the number of fadvances is tstop/dt).