Skip navigation
Weisang Logo
Weisang Logo

FlexPro Documentation 2025

Indexed Assignment

Assigns a new value to a section of a data set or replaces a substring or a single character in a string.

FPScript Syntax

Term Index1[Index2] = Expression

where Index1 stands for the following variants:

[]

or

[Index]

or

[from, to]

or

[[ ]]

or

[[ValueIndex]]

or

[[ValueFrom, ValueTo]]

and the optional Index2 stands for the following variants:

[Index]

or

[from, to]

or

[[ValueIndex]]

or

[[ValueFrom, ValueTo]]

Python Syntax

Term.[y|x|z]i[Index1[, Index2]] = Expression

where the following can be specified for Index1:

None

or

Index

or

[Start]:[End]:[Step]

and optionally for Index2:

Index

or

[Start]:[End]:[Step]

or

Term.v[ValueIndex1[, ValueIndex2]] = Expression

where the following can be specified for ValueIndex1:

None

or

Value

or

StartValue:EndValue:[Step]

and optionally for ValueIndex2:

Value

or

StartValue:EndValue:[Step]

The syntax of the Indexed Assignment consists of the following elements:

Element

Description

Term

An expression that denotes a variable or a component or a list element in it. In the target determined this way, the indexed assignment replaces part of the data.

In Python, Term must be of type flexpro.Data.

Index

Specifies the number(s) of the value(s) to be indexed. Can be an integral scalar value or a data series with integral values.

from

Specifies the index of the first value of a range to be indexed. Must be an integral scalar value.

to

Specifies the index of the last value of a range to be indexed. Must be an integral scalar value.

Start, End, Step

These are the parameters of a Python slice that determines the numbers of the values to be indexed. All parameters are optional. If Start is omitted, the series begins with index 0. If End is omitted, the series runs to the end of the data set to be indexed. Otherwise, End indicates the index before which the series ends! If Step is omitted, the step width 1 applies.

ValueIndex

Specifies the X or Z values of the value(s) or signals to be indexed. Can be a numeric scalar value, a data series with numeric values or of the Empty data type.

ValueFrom

Specifies the X or Z value of the first value or signal of a range to be indexed. Must be a numeric scalar value or of the Empty data type.

ValueTo

Specifies the X or Z value of the last value or signal of a range to be indexed. Must be a numeric scalar value or of the Empty data type.

StartValue, EndValue, Step

These are the parameters of a Python slice that determine the X or Z values of the values to be indexed. If Step is omitted, all values in the range from StartValue to EndValue are indexed. Otherwise, a linear data series is formed from the three parameters using the Series function.

Expression

Any expression with a scalar value or another data structure that must match the indexed section exactly. Depending on the index, the expression must be a scalar value, a data series or a data matrix. If you specify a scalar value, then this is assigned to all indexed elements in the data set.

Remarks

Using an index written with single brackets in FPScript and introduced with .i in Python, you address the data to be changed via their indices. When you apply the indexed assignment to a signal, signal series, or space curve, only the Y component is considered, unless you explicitly address the X or Z component with the component operator.

The indices are counted starting from zero. Negative indices are counted from the end, i.e. the index -1 corresponds to the last element, -2 corresponds to the second to last element, and so forth. With a two-dimensional data matrix, you can specify two indices consecutively. The first index then refers to the data series in the data matrix and the optional second index to the values in the data series extracted using the first index. If you leave the first index blank or specify Index as the Boolean value TRUE, then this indexes all data series.

As the syntax shows, you can specify the index in three variations: If you specify a scalar value (scalar value index) in the index, the index takes one element, and the rank of the result decreases by one. If you specify as Index a data series (data series index) or a range From, To (range index), the elements listed in the data series or the elements in the range are taken. The rank of the result corresponds to the rank of the expression to be indexed.

If Index, from or to is a quantity, then it has to have the SI dimension 1 and it will be transformed to the unit 1 before indexing.

With the value index written in FPScript with double brackets and introduced in Python with .v, indexing is not carried out via indices, but via X or Z values. Accordingly, the data set must have a composite data structure. Signal series with a two-dimensional X component are not supported. If the specified X or Z values do not occur exactly in the data set, the positions of the values closest to the specified values are used. To determine the indices corresponding to the specified X or Z values, the value index operator uses the SearchValue function. Void floating point values are not allowed as value indices.

If ValueIndex, ValueFrom or ValueTo is a quantity, then this quantity must have the same SI dimension as the corresponding component of Term and will be transformed to its unit before indexing. If only numerical values are specified without a unit, then these are interpreted as being present in the corresponding unit.

The Expression data type is adapted before the assignment to the Term data type, if applicable.

If Term and Expression are quantities, then they have to have the same SI dimension and the unit of Expression is transformed before being assigned to the unit of Term. If only Term is a quantity, then the same unit is used for Expression. If only Expression is a quantity and the unit monitoring is set to Strict, then an error message will appear. Otherwise, the unit is ignored.

If Term is a list, then the index operation is carried out by element and the result is also a list. In this case Expression, Index1 and Index2 can also be specified as a list.

The indexed assignment to a string is only permitted for a scalar string value.

Note   When accessing two-dimensional data sets, you can combine the value index operator and the index operator (hybrid Index).

The following table lists all of the possible combinations except for the hybrid cases:

FPScript

Python

 

DataSeries[ScalarValue] = ScalarValue

DataSeries.i[ScalarValue] = ScalarValue

Overwrites the value with the number specified in ScalarValue from the data series.

DataSeries[from, to] = DataSeries or ScalarValue

DataSeries.i[from:to + 1] = DataSeries or ScalarValue

Overwrites the values lying in the range from, to from the data series.

DataSeries[Series] = DataSeries or ScalarValue

DataSeries.i[Series] = DataSeries or ScalarValue

Overwrites the values specified in Series from the data series.

Signal[ScalarValue] = ScalarValue

Signal.i[ScalarValue] = ScalarValue

Overwrites the value with the number specified in ScalarValue in the Y component of the signal.

Signal[from, to] = Signal, DataSeries or ScalarValue

Signal.i[from:to + 1] = Signal, DataSeries or ScalarValue

Overwrites the signal values lying in the range from, to.

Signal[Series] = Signal, DataSeries or ScalarValue

Signal.i[Series] = Signal, DataSeries or ScalarValue

Overwrites the signal values specified in Series.

SpaceCurve[ScalarValue] = ScalarValue

SpaceCurve.i[ScalarValue] = ScalarValue

Overwrites the value with the number specified in ScalarValue in the Y component of the space curve.

SpaceCurve[from, to] = SpaceCurve, Signal, DataSeries or ScalarValue

SpaceCurve.i[from:to + 1] = SpaceCurve, Signal, DataSeries or ScalarValue

Overwrites the values in the range from, to in the space curve.

SpaceCurve[Series] = SpaceCurve, Signal, DataSeries or ScalarValue

SpaceCurve.i[Series] = SpaceCurve, Signal, DataSeries or ScalarValue

Overwrites the values specified in Series in the space curve.

DataMatrix[ScalarValue] = DataSeries or ScalarValue

DataMatrix.i[ScalarValue] = DataSeries or ScalarValue

Overwrites the column with the number specified in ScalarValue from the data matrix.

DataMatrix[from, to] = DataMatrix or ScalarValue

DataMatrix.i[from:to + 1] = DataMatrix or ScalarValue

Overwrites the columns lying in the range from, to from the data matrix.

DataMatrix[Series] = DataMatrix or ScalarValue

DataMatrix.i[Series] = DataMatrix or ScalarValue

Overwrites the columns specified in Series from the data matrix.

DataMatrix[][ScalarValue] = DataSeries or ScalarValue

DataMatrix.i[None, ScalarValue] = DataSeries or ScalarValue

Overwrites the row with the number specified in ScalarValue from the data matrix.

DataMatrix[][from, to] = DataMatrix or ScalarValue

DataMatrix.i[None, from:to + 1] = DataMatrix or ScalarValue

Overwrites the rows lying in the range from, to from the data matrix.

DataMatrix[][Series] = DataMatrix or ScalarValue

DataMatrix.i[None, Series] = DataMatrix or ScalarValue

Overwrites the rows specified in Series from the data matrix.

DataMatrix[ScalarValue1][ScalarValue2] = ScalarValue

DataMatrix.i[ScalarValue1, ScalarValue2] = ScalarValue

Overwrites the value with the column specified in ScalarValue1 and the row specified with ScalarValue2 from the data matrix.

DataMatrix[ScalarValue][from, to] = DataSeries or ScalarValue

DataMatrix.i[ScalarValue, (from, to)] = DataSeries or ScalarValue

Overwrites the values lying in the range from, to from the column specified in ScalarValue from the data matrix.

DataMatrix[ScalarValue][Series] = DataSeries or ScalarValue

DataMatrix.i[ScalarValue][Series] = DataSeries or ScalarValue

Overwrites the values specified in Series from the column specified in ScalarValue from the data matrix.

DataMatrix[from, to][ScalarValue] = DataSeries or ScalarValue

DataMatrix.i[(from, to][ScalarValue] = DataSeries or ScalarValue

Overwrites the value specified in ScalarValue from the columns lying in the range from, to from the data matrix.

DataMatrix[from1, to1][from2, to2] = DataMatrix or ScalarValue

DataMatrix.i[from1:to1 + 1, from2:to2 + 1] = DataMatrix or ScalarValue

Overwrites the rows lying in the range from2, to2 from the columns lying in the range from1, to1 from the data matrix.

DataMatrix[from, to][Series] = DataMatrix or ScalarValue

DataMatrix.i[from:to + 1, Series] = DataMatrix or ScalarValue

Overwrites the rows specified in Series from the columns lying in the range from, to from the data matrix.

DataMatrix[Series][ScalarValue] = DataSeries or ScalarValue

DataMatrix.i[Series, ScalarValue] = DataSeries or ScalarValue

Overwrites the value specified in ScalarValue from the columns specified in Series from the data matrix.

DataMatrix[Series][from, to] = DataMatrix or ScalarValue

DataMatrix.i[Series, from:to + 1)] = DataMatrix or ScalarValue

Overwrites the rows lying in the range from, to from the columns listed in Series from the data matrix.

DataMatrix[Series1][Series2] = DataMatrix or ScalarValue

DataMatrix.i[Series1, Series2] = DataMatrix or ScalarValue

Overwrites the rows listed in Series2 from the columns listed in Series1 from the data matrix.

SignalSeries[ScalarValue] = Signal, DataSeries or ScalarValue

SignalSeries.i[ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the column with the number specified in ScalarValue in the signal series.

SignalSeries[from, to] = Signal, DataMatrix or ScalarValue

SignalSeries.i[from:to + 1] = Signal, DataMatrix or ScalarValue

Overwrites the columns in the range from, to in the signal series.

SignalSeries[Series] = Signal, DataMatrix or ScalarValue

SignalSeries.i[Series] = Signal, DataMatrix or ScalarValue

Overwrites the columns specified in Series in the signal series.

SignalSeries[][ScalarValue] = Signal, DataSeries or ScalarValue

SignalSeries.i[None, ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the row with the number specified in ScalarValue in the signal series.

SignalSeries[][from, to] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.i[None, from:to + 1] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows in the range from, to in the signal series.

SignalSeries[][Series] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.i[None, Series] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows specified in Series in the signal series.

SignalSeries[ScalarValue1][ScalarValue2] = ScalarValue

SignalSeries.i[ScalarValue1, ScalarValue2] = ScalarValue

Overwrites the value with the column specified in ScalarValue1 and the row specified with ScalarValue2 in the Y component of the signal series.

SignalSeries[ScalarValue][from, to] = Signal, DataSeries or ScalarValue

SignalSeries.i[ScalarValue, from:to + 1] = Signal, DataSeries or ScalarValue

Overwrites the values lying in the range from, to from the column specified in ScalarValue in the signal series.

SignalSeries[ScalarValue][Series] = Signal, DataSeries or ScalarValue

SignalSeries.i[ScalarValue, Series] = Signal, DataSeries or ScalarValue

Overwrites the values specified in Series from the column specified in Scalar Value from the signal series.

SignalSeries[from, to][ScalarValue] = Signal, DataSeries or ScalarValue

SignalSeries.i[from:to + 1, ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the value specified in ScalarValue from the columns lying in the range from, to from the signal series.

SignalSeries[from1, to1][from2, to2] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.i[from1:to1 + 1, from2:to2 + 1] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows lying in the range from2, to2 from the columns lying in the range from1, to1 from the signal series.

SignalSeries[from, to][Series] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.i[from:to + 1, Series] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows specified in Series from the columns lying in the range from, to from the signal series.

SignalSeries[Series][ScalarValue] = Signal, DataSeries or ScalarValue

SignalSeries.i[Series, ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the value specified in Scalar Value from the columns specified in Series in the signal series.

SignalSeries[Series][from, to] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.i[Series, from:to + 1] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows in the range from, to from the columns listed in Series from the signal series.

SignalSeries[Series1][Series2] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.i[Series1, Series2] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows specified in Series2 from the columns listed in Series1 from the signal series.

Signal[[ScalarValue]] = ScalarValue

Signal.v[ScalarValue] = ScalarValue

Overwrites the Y value with the X value specified in ScalarValue in the signal.

Signal[[from, to]] = Signal, DataSeries or ScalarValue

Signal.v[from:to] = Signal, DataSeries or ScalarValue

Overwrites the Y values in the range from, to in the signal.

Signal[[Series]] = Signal, DataSeries or ScalarValue

Signal.v[Series] = Signal, DataSeries or ScalarValue

Overwrites the values with the X values specified in Series in the signal.

SpaceCurve[[ScalarValue]] = ScalarValue

SpaceCurve.v[ScalarValue] = ScalarValue

Overwrites the Y value with the X value specified in ScalarValue in the space curve.

SpaceCurve[[from, to]] = SpaceCurve, Signal, DataSeries or ScalarValue

SpaceCurve.v[from:to] = SpaceCurve, Signal, DataSeries or ScalarValue

Overwrites the values in the X range from, to in the space curve.

SpaceCurve[[Series]] = SpaceCurve, Signal, DataSeries or ScalarValue

SpaceCurve.v[Series] = SpaceCurve, Signal, DataSeries or ScalarValue

Overwrites the values with the X values specified in Series in the space curve.

SignalSeries[[ScalarValue]] = Signal, DataSeries or ScalarValue

SignalSeries.v[ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the column with the X value specified in ScalarValue in the signal series.

SignalSeries[[from, to]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[from:to] = SignalSeries, DataMatrix or ScalarValue

Overwrites the columns with the X values in the range from, to in the signal series.

SignalSeries[[Series]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[Series] = SignalSeries, DataMatrix or ScalarValue

Overwrites the columns with the X values specified in Series in the signal series.

SignalSeries[[]][[ScalarValue]] = Signal, DataSeries or ScalarValue

SignalSeries.v[None, ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the row with the Z value specified in ScalarValue in the signal series.

SignalSeries[[]][[from, to]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[None, from:to] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows with the X values in the range from, to in the signal series.

SignalSeries[[]]][Series]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[None, Series] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows with the X values specified in Series in the signal series.

SignalSeries[[ScalarValue1]][[ScalarValue2]] = ScalarValue

SignalSeries.v[ScalarValue1, ScalarValue2] = ScalarValue

Overwrites the Y value with the Z value specified in ScalarValue1 and the X value specified in ScalarValue2 in the signal series.

SignalSeries[[ScalarValue]][[from, to]] = Signal, DataSeries or ScalarValue

SignalSeries.v[ScalarValue, from:to] = Signal, DataSeries or ScalarValue

Overwrites the values with the X values in the range from, to in the column with the Z value specified in ScalarValue in the signal series.

SignalSeries[[ScalarValue]][[Series]] = Signal, DataSeries or ScalarValue

SignalSeries.v[ScalarValue, Series] = Signal, DataSeries or ScalarValue

Overwrites the values with the Y values specified in Series in the column with the X value specified in ScalarValue in the signal series.

SignalSeries[[from, to]][[ScalarValue]] = Signal, DataSeries or ScalarValue

SignalSeries.v[from:to, ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the values with the X value specified in ScalarValue in columns with the Z values in the range from, to from the signal series.

SignalSeries[[from1, to1]][[from2, to2]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[from1:to1, from2:to2] = SignalSeries, DataMatrix or ScalarValue

Overwrites the values with the X values in the range from2, to2 in columns with the Z values in the range from1, to1 from the signal series.

SignalSeries[[from, to]][[Series]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[from:to, Series] = SignalSeries, DataMatrix or ScalarValue

Overwrites the values with the X values listed in Series in columns with the Z values in the range from, to from the signal series.

SignalSeries[[Series]][[ScalarValue]] = Signal, DataSeries or ScalarValue

SignalSeries.v[Series, ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the values with the X value specified in ScalarValue in columns with the Z values listed in Series in the signal series.

SignalSeries[[Series]][[from, to]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[Series, from:to] = SignalSeries, DataMatrix or ScalarValue

Overwrites the values with the X values in the range from, to in columns with the Z values listed in Series in the signal series.

SignalSeries[[Series1]][[Series2]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[Series1, Series2] = SignalSeries, DataMatrix or ScalarValue

Overwrites the values with the X values listed in Series2 in columns with the Z values listed in Series1 in the signal series.

String[ScalarValue] = Scalar integer with character code

String[ScalarValue] = Scalar integer with character code

Overwrites the character with the number specified in ScalarValue in the string.

String[from, to] = String

String[from:to] = String

Replaces the substring in the range from, to in the string. The assigned string can be longer or shorter.

String[Series] = String

String[Series] = String

Overwrites the characters specified in Series in the string. The assigned string must have the same length as Series.

The hybrid cases are formed in Python by combining .i and .v:

FPScript

Python

 

SignalSeries[ScalarValue1 ][[ScalarValue2 ]] = ScalarValue

SignalSeries.i[ScalarValue1 ].v[ScalarValue2 ] = ScalarValue

Overwrites the Y value with the Z index specified in ScalarValue1 and the X value specified in ScalarValue2 in the signal series.

SignalSeries[[ScalarValue]][from, to] = Signal, DataSeries oder ScalarValue

SignalSeries.v[ScalarValue].i[from:to + 1] = Signal, DataSeries oder ScalarValue

Overwrites the values with the X values in the range from, to in the column with the Z value specified in ScalarValue in the signal series.

The indexed assignment to a component is done in Python by prefixing i with y, x, or z:

FPScript

Python

 

Signal.X[ScalarValue] = ScalarValue

SignalSeries.xi[ScalarValue] = ScalarValue

Overwrites the value with the number specified in ScalarValue in the X component of the signal.

Direct indexed assignment to a component of a list element is not possible in Python:

FPScript

Python

 

List.[Element].X[ScalarValue] = ScalarValue

x = List.xl[Element]
x.i[ScalarValue] = ScalarValue

List.xl[Element] = x

or

e = List[Element]
e.xi[ScalarValue] = ScalarValue

List[Element] = e

Overwrites the value with the number specified in ScalarValue in the X component of the list element with the index Element.

In Python, the X component of the list element is first extracted, then changed by the indexed assignment and then written back into the list. Alternatively, the complete signal can be extracted and its X component changed.

Available In

FlexPro View, Basic, Professional, Developer Suite

Examples

FPScript

Python

 

List.[1n][0n, 99n] = ?

List.l[1].i[(0, 99)] = float('nan')

sets the first 100 elements in the data series, found in the second element of the list saved in the List variable, to void.

List.Signal1.X[0n, 99n] = ?

x = List.xl['Signal1']

x.i[0:100] = float('nan')

List.xl['Signal1'] = x

sets the first 100 elements in the X component of the list element "Signal1" to void.

Signal[-3n, -1n] = { 3.5, 4.8, 1.2 }

Signal.i[-3:] = fp.bundle(3.5, 4.8, 1.2)

changes the last three values in the Y-component of Signal.

Signal.X[0n] = 1

Signal.xi[0] = 1.

sets the first X value in Signal to the value 1.

Signal[[1.2 s, 5.4 s]] = 0

Signal.v[fp.Data(1.2 's'), fp.Data(5.4 's')] = 0.

sets all Y values in the X range from 1.2 s to 5.4 s in the signal to the value 0.

Series[{1n, 2n, -1n}] = ?

Series.i[fp.bundle(1, 2, -1)] = float('nan')

sets the second, third and last value in Series to void.

DataMatrix[][0n] = Row

DataMatrix.i[None, 0] = Row

replaces the first row in DataMatrix with the values in the data series Row.

String[1n] = "a"

String.i[1] = 'a'

replaces the second character in String with the character 'a'.

String[-1n] = 97n

String.i[-1] = 97

replaces the second character in String with the character 'a'.

String[1n, 3n] = "abc"

String.i[1:4] = 'abc'

replaces three characters starting with the second character in String with the substring "abc".

String[3n, 2n] = "abc"

String.i[3:3] = 'abc'

inserts the string "abc" at position 3 in String.

String[0n, -1n] = "abc"

String.i[:] = 'abc'

replaces String with the substring "abc".

 

See Also

Index Operator

Assignment

idx_assign Function (Python)

listidx_assign Function (Python)

validx_assign Function (Python)

FlexPro Documentation 2025

Indexed Assignment

Assigns a new value to a section of a data set or replaces a substring or a single character in a string.

FPScript Syntax

Term Index1[Index2] = Expression

where Index1 stands for the following variants:

[]

or

[Index]

or

[from, to]

or

[[ ]]

or

[[ValueIndex]]

or

[[ValueFrom, ValueTo]]

and the optional Index2 stands for the following variants:

[Index]

or

[from, to]

or

[[ValueIndex]]

or

[[ValueFrom, ValueTo]]

Python Syntax

Term.[y|x|z]i[Index1[, Index2]] = Expression

where the following can be specified for Index1:

None

or

Index

or

[Start]:[End]:[Step]

and optionally for Index2:

Index

or

[Start]:[End]:[Step]

or

Term.v[ValueIndex1[, ValueIndex2]] = Expression

where the following can be specified for ValueIndex1:

None

or

Value

or

StartValue:EndValue:[Step]

and optionally for ValueIndex2:

Value

or

StartValue:EndValue:[Step]

The syntax of the Indexed Assignment consists of the following elements:

Element

Description

Term

An expression that denotes a variable or a component or a list element in it. In the target determined this way, the indexed assignment replaces part of the data.

In Python, Term must be of type flexpro.Data.

Index

Specifies the number(s) of the value(s) to be indexed. Can be an integral scalar value or a data series with integral values.

from

Specifies the index of the first value of a range to be indexed. Must be an integral scalar value.

to

Specifies the index of the last value of a range to be indexed. Must be an integral scalar value.

Start, End, Step

These are the parameters of a Python slice that determines the numbers of the values to be indexed. All parameters are optional. If Start is omitted, the series begins with index 0. If End is omitted, the series runs to the end of the data set to be indexed. Otherwise, End indicates the index before which the series ends! If Step is omitted, the step width 1 applies.

ValueIndex

Specifies the X or Z values of the value(s) or signals to be indexed. Can be a numeric scalar value, a data series with numeric values or of the Empty data type.

ValueFrom

Specifies the X or Z value of the first value or signal of a range to be indexed. Must be a numeric scalar value or of the Empty data type.

ValueTo

Specifies the X or Z value of the last value or signal of a range to be indexed. Must be a numeric scalar value or of the Empty data type.

StartValue, EndValue, Step

These are the parameters of a Python slice that determine the X or Z values of the values to be indexed. If Step is omitted, all values in the range from StartValue to EndValue are indexed. Otherwise, a linear data series is formed from the three parameters using the Series function.

Expression

Any expression with a scalar value or another data structure that must match the indexed section exactly. Depending on the index, the expression must be a scalar value, a data series or a data matrix. If you specify a scalar value, then this is assigned to all indexed elements in the data set.

Remarks

Using an index written with single brackets in FPScript and introduced with .i in Python, you address the data to be changed via their indices. When you apply the indexed assignment to a signal, signal series, or space curve, only the Y component is considered, unless you explicitly address the X or Z component with the component operator.

The indices are counted starting from zero. Negative indices are counted from the end, i.e. the index -1 corresponds to the last element, -2 corresponds to the second to last element, and so forth. With a two-dimensional data matrix, you can specify two indices consecutively. The first index then refers to the data series in the data matrix and the optional second index to the values in the data series extracted using the first index. If you leave the first index blank or specify Index as the Boolean value TRUE, then this indexes all data series.

As the syntax shows, you can specify the index in three variations: If you specify a scalar value (scalar value index) in the index, the index takes one element, and the rank of the result decreases by one. If you specify as Index a data series (data series index) or a range From, To (range index), the elements listed in the data series or the elements in the range are taken. The rank of the result corresponds to the rank of the expression to be indexed.

If Index, from or to is a quantity, then it has to have the SI dimension 1 and it will be transformed to the unit 1 before indexing.

With the value index written in FPScript with double brackets and introduced in Python with .v, indexing is not carried out via indices, but via X or Z values. Accordingly, the data set must have a composite data structure. Signal series with a two-dimensional X component are not supported. If the specified X or Z values do not occur exactly in the data set, the positions of the values closest to the specified values are used. To determine the indices corresponding to the specified X or Z values, the value index operator uses the SearchValue function. Void floating point values are not allowed as value indices.

If ValueIndex, ValueFrom or ValueTo is a quantity, then this quantity must have the same SI dimension as the corresponding component of Term and will be transformed to its unit before indexing. If only numerical values are specified without a unit, then these are interpreted as being present in the corresponding unit.

The Expression data type is adapted before the assignment to the Term data type, if applicable.

If Term and Expression are quantities, then they have to have the same SI dimension and the unit of Expression is transformed before being assigned to the unit of Term. If only Term is a quantity, then the same unit is used for Expression. If only Expression is a quantity and the unit monitoring is set to Strict, then an error message will appear. Otherwise, the unit is ignored.

If Term is a list, then the index operation is carried out by element and the result is also a list. In this case Expression, Index1 and Index2 can also be specified as a list.

The indexed assignment to a string is only permitted for a scalar string value.

Note   When accessing two-dimensional data sets, you can combine the value index operator and the index operator (hybrid Index).

The following table lists all of the possible combinations except for the hybrid cases:

FPScript

Python

 

DataSeries[ScalarValue] = ScalarValue

DataSeries.i[ScalarValue] = ScalarValue

Overwrites the value with the number specified in ScalarValue from the data series.

DataSeries[from, to] = DataSeries or ScalarValue

DataSeries.i[from:to + 1] = DataSeries or ScalarValue

Overwrites the values lying in the range from, to from the data series.

DataSeries[Series] = DataSeries or ScalarValue

DataSeries.i[Series] = DataSeries or ScalarValue

Overwrites the values specified in Series from the data series.

Signal[ScalarValue] = ScalarValue

Signal.i[ScalarValue] = ScalarValue

Overwrites the value with the number specified in ScalarValue in the Y component of the signal.

Signal[from, to] = Signal, DataSeries or ScalarValue

Signal.i[from:to + 1] = Signal, DataSeries or ScalarValue

Overwrites the signal values lying in the range from, to.

Signal[Series] = Signal, DataSeries or ScalarValue

Signal.i[Series] = Signal, DataSeries or ScalarValue

Overwrites the signal values specified in Series.

SpaceCurve[ScalarValue] = ScalarValue

SpaceCurve.i[ScalarValue] = ScalarValue

Overwrites the value with the number specified in ScalarValue in the Y component of the space curve.

SpaceCurve[from, to] = SpaceCurve, Signal, DataSeries or ScalarValue

SpaceCurve.i[from:to + 1] = SpaceCurve, Signal, DataSeries or ScalarValue

Overwrites the values in the range from, to in the space curve.

SpaceCurve[Series] = SpaceCurve, Signal, DataSeries or ScalarValue

SpaceCurve.i[Series] = SpaceCurve, Signal, DataSeries or ScalarValue

Overwrites the values specified in Series in the space curve.

DataMatrix[ScalarValue] = DataSeries or ScalarValue

DataMatrix.i[ScalarValue] = DataSeries or ScalarValue

Overwrites the column with the number specified in ScalarValue from the data matrix.

DataMatrix[from, to] = DataMatrix or ScalarValue

DataMatrix.i[from:to + 1] = DataMatrix or ScalarValue

Overwrites the columns lying in the range from, to from the data matrix.

DataMatrix[Series] = DataMatrix or ScalarValue

DataMatrix.i[Series] = DataMatrix or ScalarValue

Overwrites the columns specified in Series from the data matrix.

DataMatrix[][ScalarValue] = DataSeries or ScalarValue

DataMatrix.i[None, ScalarValue] = DataSeries or ScalarValue

Overwrites the row with the number specified in ScalarValue from the data matrix.

DataMatrix[][from, to] = DataMatrix or ScalarValue

DataMatrix.i[None, from:to + 1] = DataMatrix or ScalarValue

Overwrites the rows lying in the range from, to from the data matrix.

DataMatrix[][Series] = DataMatrix or ScalarValue

DataMatrix.i[None, Series] = DataMatrix or ScalarValue

Overwrites the rows specified in Series from the data matrix.

DataMatrix[ScalarValue1][ScalarValue2] = ScalarValue

DataMatrix.i[ScalarValue1, ScalarValue2] = ScalarValue

Overwrites the value with the column specified in ScalarValue1 and the row specified with ScalarValue2 from the data matrix.

DataMatrix[ScalarValue][from, to] = DataSeries or ScalarValue

DataMatrix.i[ScalarValue, (from, to)] = DataSeries or ScalarValue

Overwrites the values lying in the range from, to from the column specified in ScalarValue from the data matrix.

DataMatrix[ScalarValue][Series] = DataSeries or ScalarValue

DataMatrix.i[ScalarValue][Series] = DataSeries or ScalarValue

Overwrites the values specified in Series from the column specified in ScalarValue from the data matrix.

DataMatrix[from, to][ScalarValue] = DataSeries or ScalarValue

DataMatrix.i[(from, to][ScalarValue] = DataSeries or ScalarValue

Overwrites the value specified in ScalarValue from the columns lying in the range from, to from the data matrix.

DataMatrix[from1, to1][from2, to2] = DataMatrix or ScalarValue

DataMatrix.i[from1:to1 + 1, from2:to2 + 1] = DataMatrix or ScalarValue

Overwrites the rows lying in the range from2, to2 from the columns lying in the range from1, to1 from the data matrix.

DataMatrix[from, to][Series] = DataMatrix or ScalarValue

DataMatrix.i[from:to + 1, Series] = DataMatrix or ScalarValue

Overwrites the rows specified in Series from the columns lying in the range from, to from the data matrix.

DataMatrix[Series][ScalarValue] = DataSeries or ScalarValue

DataMatrix.i[Series, ScalarValue] = DataSeries or ScalarValue

Overwrites the value specified in ScalarValue from the columns specified in Series from the data matrix.

DataMatrix[Series][from, to] = DataMatrix or ScalarValue

DataMatrix.i[Series, from:to + 1)] = DataMatrix or ScalarValue

Overwrites the rows lying in the range from, to from the columns listed in Series from the data matrix.

DataMatrix[Series1][Series2] = DataMatrix or ScalarValue

DataMatrix.i[Series1, Series2] = DataMatrix or ScalarValue

Overwrites the rows listed in Series2 from the columns listed in Series1 from the data matrix.

SignalSeries[ScalarValue] = Signal, DataSeries or ScalarValue

SignalSeries.i[ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the column with the number specified in ScalarValue in the signal series.

SignalSeries[from, to] = Signal, DataMatrix or ScalarValue

SignalSeries.i[from:to + 1] = Signal, DataMatrix or ScalarValue

Overwrites the columns in the range from, to in the signal series.

SignalSeries[Series] = Signal, DataMatrix or ScalarValue

SignalSeries.i[Series] = Signal, DataMatrix or ScalarValue

Overwrites the columns specified in Series in the signal series.

SignalSeries[][ScalarValue] = Signal, DataSeries or ScalarValue

SignalSeries.i[None, ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the row with the number specified in ScalarValue in the signal series.

SignalSeries[][from, to] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.i[None, from:to + 1] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows in the range from, to in the signal series.

SignalSeries[][Series] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.i[None, Series] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows specified in Series in the signal series.

SignalSeries[ScalarValue1][ScalarValue2] = ScalarValue

SignalSeries.i[ScalarValue1, ScalarValue2] = ScalarValue

Overwrites the value with the column specified in ScalarValue1 and the row specified with ScalarValue2 in the Y component of the signal series.

SignalSeries[ScalarValue][from, to] = Signal, DataSeries or ScalarValue

SignalSeries.i[ScalarValue, from:to + 1] = Signal, DataSeries or ScalarValue

Overwrites the values lying in the range from, to from the column specified in ScalarValue in the signal series.

SignalSeries[ScalarValue][Series] = Signal, DataSeries or ScalarValue

SignalSeries.i[ScalarValue, Series] = Signal, DataSeries or ScalarValue

Overwrites the values specified in Series from the column specified in Scalar Value from the signal series.

SignalSeries[from, to][ScalarValue] = Signal, DataSeries or ScalarValue

SignalSeries.i[from:to + 1, ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the value specified in ScalarValue from the columns lying in the range from, to from the signal series.

SignalSeries[from1, to1][from2, to2] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.i[from1:to1 + 1, from2:to2 + 1] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows lying in the range from2, to2 from the columns lying in the range from1, to1 from the signal series.

SignalSeries[from, to][Series] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.i[from:to + 1, Series] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows specified in Series from the columns lying in the range from, to from the signal series.

SignalSeries[Series][ScalarValue] = Signal, DataSeries or ScalarValue

SignalSeries.i[Series, ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the value specified in Scalar Value from the columns specified in Series in the signal series.

SignalSeries[Series][from, to] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.i[Series, from:to + 1] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows in the range from, to from the columns listed in Series from the signal series.

SignalSeries[Series1][Series2] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.i[Series1, Series2] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows specified in Series2 from the columns listed in Series1 from the signal series.

Signal[[ScalarValue]] = ScalarValue

Signal.v[ScalarValue] = ScalarValue

Overwrites the Y value with the X value specified in ScalarValue in the signal.

Signal[[from, to]] = Signal, DataSeries or ScalarValue

Signal.v[from:to] = Signal, DataSeries or ScalarValue

Overwrites the Y values in the range from, to in the signal.

Signal[[Series]] = Signal, DataSeries or ScalarValue

Signal.v[Series] = Signal, DataSeries or ScalarValue

Overwrites the values with the X values specified in Series in the signal.

SpaceCurve[[ScalarValue]] = ScalarValue

SpaceCurve.v[ScalarValue] = ScalarValue

Overwrites the Y value with the X value specified in ScalarValue in the space curve.

SpaceCurve[[from, to]] = SpaceCurve, Signal, DataSeries or ScalarValue

SpaceCurve.v[from:to] = SpaceCurve, Signal, DataSeries or ScalarValue

Overwrites the values in the X range from, to in the space curve.

SpaceCurve[[Series]] = SpaceCurve, Signal, DataSeries or ScalarValue

SpaceCurve.v[Series] = SpaceCurve, Signal, DataSeries or ScalarValue

Overwrites the values with the X values specified in Series in the space curve.

SignalSeries[[ScalarValue]] = Signal, DataSeries or ScalarValue

SignalSeries.v[ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the column with the X value specified in ScalarValue in the signal series.

SignalSeries[[from, to]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[from:to] = SignalSeries, DataMatrix or ScalarValue

Overwrites the columns with the X values in the range from, to in the signal series.

SignalSeries[[Series]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[Series] = SignalSeries, DataMatrix or ScalarValue

Overwrites the columns with the X values specified in Series in the signal series.

SignalSeries[[]][[ScalarValue]] = Signal, DataSeries or ScalarValue

SignalSeries.v[None, ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the row with the Z value specified in ScalarValue in the signal series.

SignalSeries[[]][[from, to]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[None, from:to] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows with the X values in the range from, to in the signal series.

SignalSeries[[]]][Series]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[None, Series] = SignalSeries, DataMatrix or ScalarValue

Overwrites the rows with the X values specified in Series in the signal series.

SignalSeries[[ScalarValue1]][[ScalarValue2]] = ScalarValue

SignalSeries.v[ScalarValue1, ScalarValue2] = ScalarValue

Overwrites the Y value with the Z value specified in ScalarValue1 and the X value specified in ScalarValue2 in the signal series.

SignalSeries[[ScalarValue]][[from, to]] = Signal, DataSeries or ScalarValue

SignalSeries.v[ScalarValue, from:to] = Signal, DataSeries or ScalarValue

Overwrites the values with the X values in the range from, to in the column with the Z value specified in ScalarValue in the signal series.

SignalSeries[[ScalarValue]][[Series]] = Signal, DataSeries or ScalarValue

SignalSeries.v[ScalarValue, Series] = Signal, DataSeries or ScalarValue

Overwrites the values with the Y values specified in Series in the column with the X value specified in ScalarValue in the signal series.

SignalSeries[[from, to]][[ScalarValue]] = Signal, DataSeries or ScalarValue

SignalSeries.v[from:to, ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the values with the X value specified in ScalarValue in columns with the Z values in the range from, to from the signal series.

SignalSeries[[from1, to1]][[from2, to2]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[from1:to1, from2:to2] = SignalSeries, DataMatrix or ScalarValue

Overwrites the values with the X values in the range from2, to2 in columns with the Z values in the range from1, to1 from the signal series.

SignalSeries[[from, to]][[Series]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[from:to, Series] = SignalSeries, DataMatrix or ScalarValue

Overwrites the values with the X values listed in Series in columns with the Z values in the range from, to from the signal series.

SignalSeries[[Series]][[ScalarValue]] = Signal, DataSeries or ScalarValue

SignalSeries.v[Series, ScalarValue] = Signal, DataSeries or ScalarValue

Overwrites the values with the X value specified in ScalarValue in columns with the Z values listed in Series in the signal series.

SignalSeries[[Series]][[from, to]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[Series, from:to] = SignalSeries, DataMatrix or ScalarValue

Overwrites the values with the X values in the range from, to in columns with the Z values listed in Series in the signal series.

SignalSeries[[Series1]][[Series2]] = SignalSeries, DataMatrix or ScalarValue

SignalSeries.v[Series1, Series2] = SignalSeries, DataMatrix or ScalarValue

Overwrites the values with the X values listed in Series2 in columns with the Z values listed in Series1 in the signal series.

String[ScalarValue] = Scalar integer with character code

String[ScalarValue] = Scalar integer with character code

Overwrites the character with the number specified in ScalarValue in the string.

String[from, to] = String

String[from:to] = String

Replaces the substring in the range from, to in the string. The assigned string can be longer or shorter.

String[Series] = String

String[Series] = String

Overwrites the characters specified in Series in the string. The assigned string must have the same length as Series.

The hybrid cases are formed in Python by combining .i and .v:

FPScript

Python

 

SignalSeries[ScalarValue1 ][[ScalarValue2 ]] = ScalarValue

SignalSeries.i[ScalarValue1 ].v[ScalarValue2 ] = ScalarValue

Overwrites the Y value with the Z index specified in ScalarValue1 and the X value specified in ScalarValue2 in the signal series.

SignalSeries[[ScalarValue]][from, to] = Signal, DataSeries oder ScalarValue

SignalSeries.v[ScalarValue].i[from:to + 1] = Signal, DataSeries oder ScalarValue

Overwrites the values with the X values in the range from, to in the column with the Z value specified in ScalarValue in the signal series.

The indexed assignment to a component is done in Python by prefixing i with y, x, or z:

FPScript

Python

 

Signal.X[ScalarValue] = ScalarValue

SignalSeries.xi[ScalarValue] = ScalarValue

Overwrites the value with the number specified in ScalarValue in the X component of the signal.

Direct indexed assignment to a component of a list element is not possible in Python:

FPScript

Python

 

List.[Element].X[ScalarValue] = ScalarValue

x = List.xl[Element]
x.i[ScalarValue] = ScalarValue

List.xl[Element] = x

or

e = List[Element]
e.xi[ScalarValue] = ScalarValue

List[Element] = e

Overwrites the value with the number specified in ScalarValue in the X component of the list element with the index Element.

In Python, the X component of the list element is first extracted, then changed by the indexed assignment and then written back into the list. Alternatively, the complete signal can be extracted and its X component changed.

Available In

FlexPro View, Basic, Professional, Developer Suite

Examples

FPScript

Python

 

List.[1n][0n, 99n] = ?

List.l[1].i[(0, 99)] = float('nan')

sets the first 100 elements in the data series, found in the second element of the list saved in the List variable, to void.

List.Signal1.X[0n, 99n] = ?

x = List.xl['Signal1']

x.i[0:100] = float('nan')

List.xl['Signal1'] = x

sets the first 100 elements in the X component of the list element "Signal1" to void.

Signal[-3n, -1n] = { 3.5, 4.8, 1.2 }

Signal.i[-3:] = fp.bundle(3.5, 4.8, 1.2)

changes the last three values in the Y-component of Signal.

Signal.X[0n] = 1

Signal.xi[0] = 1.

sets the first X value in Signal to the value 1.

Signal[[1.2 s, 5.4 s]] = 0

Signal.v[fp.Data(1.2 's'), fp.Data(5.4 's')] = 0.

sets all Y values in the X range from 1.2 s to 5.4 s in the signal to the value 0.

Series[{1n, 2n, -1n}] = ?

Series.i[fp.bundle(1, 2, -1)] = float('nan')

sets the second, third and last value in Series to void.

DataMatrix[][0n] = Row

DataMatrix.i[None, 0] = Row

replaces the first row in DataMatrix with the values in the data series Row.

String[1n] = "a"

String.i[1] = 'a'

replaces the second character in String with the character 'a'.

String[-1n] = 97n

String.i[-1] = 97

replaces the second character in String with the character 'a'.

String[1n, 3n] = "abc"

String.i[1:4] = 'abc'

replaces three characters starting with the second character in String with the substring "abc".

String[3n, 2n] = "abc"

String.i[3:3] = 'abc'

inserts the string "abc" at position 3 in String.

String[0n, -1n] = "abc"

String.i[:] = 'abc'

replaces String with the substring "abc".

 

See Also

Index Operator

Assignment

idx_assign Function (Python)

listidx_assign Function (Python)

validx_assign Function (Python)