vector.min()

Anything that doesn't fit elsewhere.
Post Reply
Gannier

vector.min()

Post 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 ?
ted
Site Admin
Posts: 6384
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post 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.
Gannier

Post 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)
ted
Site Admin
Posts: 6384
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post 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).
Post Reply