NewContVar
Creates a new continuous variable.
Syntax
NewContVar(doc, frequency, mVmin, mVmax)
Parameters
Parameter |
Type |
Description |
---|---|---|
doc |
documentReference |
Reference to the document |
frequency |
number |
Specifies the sampling frequency of the new variable (in Hz) |
mVmin |
number |
Minimum of the values of the new variable (in milliVolts) |
mVmax |
number |
Maximum of the values of the new variable (in milliVolts) |
Return
Returns a reference to the new variable.
Note
When you use this function, NeuroExplorer will store the values of the new continuous variable as scaled 2-byte integers. Specifying minimum and maximum of the variable values helps to determine the correct scaling factor for the new variable.
It is recommended that you use nex.NewContVarWithFloats
function instead of this function.
Examples
Python
import nex
import math
doc = nex.GetActiveDocument()
freq = 1000.
# create new variable in the file
doc["SinValues"] = nex.NewContVar(doc, freq, - 500., 500.)
# add the values to the new variable
for i in range(1000):
# timestamp
ts = i / freq
# value
value = 500. * math.sin(ts)
nex.AddContValue(doc["SinValues"], ts, value)
NexScript
doc = GetActiveDocument()
freq = 1000.
% create new variable in the file
doc["SinValues"] = NewContVar(doc, freq, -500.,500.)
% add the values to the new variable
for i = 1 to 10000
% timestamp
ts = i/freq
% value
value = 500.*sin(ts)
AddContValue(doc["SinValues"], ts, value)
end