NewContVarWithFloats

Creates a new continuous variable, returns a reference to the new variable. Frequency specifies the sampling frequency of the new variable (in Hz).

Syntax

NewContVarWithFloats(doc, frequency)

Parameters

Parameter

Type

Description

doc

documentReference

Reference to the document

frequency

number

Sampling frequency of the new variable (in Hz)

Return

Creates a new continuous variable, returns a reference to the new variable.

Examples

Python

import nex
import math
doc = nex.GetActiveDocument()
freq = 1000.
# create new variable in the file
doc["SinValues"] = nex.NewContVarWithFloats(doc, freq)
# 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"] = NewContVarWithFloats(doc, freq)
% 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