Append Statement (FPScript)
Appends additional data to a value saved in a variable.
Syntax
Variable := Expression
or
Variable ::= Expression
The syntax of the Append statement consists of the following elements:
Element |
Description |
---|---|
Variable |
The name of a variable or a data set. |
Expression |
Any expression whose value is to be appended to the value existing in a variable. |
Remarks
The statement Variable := Expression is equivalent to the statement Variable = Variable Analysis object: Expression, and the statement Variable ::= Expression is equivalent to the statement Variable = Variable :: Expression. You should, however, favor the Append statement, since this is more efficient. The Append statement is especially optimized for applications where successive scalar values are picked up.
If Variable and Expression are a quantity, then they have to have the same SI dimension, and the unit of Expression is transformed to the unit of Variable prior to appending the value. If only one argument is a quantity, then the same unit is used for the other argument.
An exact description of how the Append statement operates can be found in the description of the concatenation operator.
Available in
FlexPro View, Basic, Professional, Developer Suite
Example
The following example calculates the RMS value for individual waves in a sinusoidal signal and returns this as a data series:
Arguments Data
Dim n, Idx, Result
// Retrieve all zero-crossings in positive direction
Idx = LevelCrossings(Data, 0, 0.1 * Maximum(Data), EVENT_INDEX + EVENT_POSITIVE)
n = NumberOfRows(Idx)
// If less than 2 zero-crossings, then return data series with 0 elements
If NumberOfRows(Idx) < 2 Then
return 0 # 0n
End
For i = 1n To n - 1n Do
Result := Mean(Data[Idx, Idx], MEAN_SQUARE)
End
Result