ChangeUnitSymbol (FPScript)

21.09.2021

Replaces one or more unit symbols of a data set.

Syntax

ChangeUnitSymbol(DataSet, [ UnitSymbol ], [ UnitSymbolX ], [ UnitSymbolZ ] [ , Verify = TRUE ])

 

The syntax of the ChangeUnitSymbol function consists of the following parts:

Part

Description

DataSet

The data set with the unit symbol(s) to be replaced.

All data structures are allowed. Supported data types are 32-bit floating point, 64-bit floating point, complex 32-bit floating point, complex 64-bit floating point, calendar time und time span.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

UnitSymbol

Specifies the unit symbol for the data set or its Y component.

Permitted data structures are scalar value. Supported data types are string.

UnitSymbolX

Specifies the unit symbol for the X component of the data set.

Permitted data structures are scalar value. Supported data types are string.

UnitSymbolZ

Specifies the unit symbol for the Z component of the data set.

Permitted data structures are scalar value. Supported data types are string.

Verify

TRUE if the unit symbol should be checked to determine if it matches the existing unit.

Permitted data structures are scalar value. Supported data types are Boolean value.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value TRUE.

Remarks

Use this function to replace the unit symbol generated automatically by FlexPro with a custom unit symbol. By replacing the unit symbol, the unit of DataSet remains unchanged and only the symbol representing the unit is replaced. If DataSet does not have a unit, then the function will have no effect. If an empty string is specified for one of the arguments Unit, UnitX or UnitZ, the corresponding custom unit symbol, if present, is removed. FlexPro will then regenerate the unit symbol automatically. If you omit an argument, the corresponding unit will remain unchanged.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

ChangeUnitSymbol(600 Nm / 300 1/min, "Nm/(1/min)")

Results in 2 Nm/(1/min). The unit symbol is changed from "Nm min" to "Nm/(1/min)".

ChangeUnitSymbol(5 kOhm, "")

Results in 5 kΩ. The unit symbol "kOhm" is deleted. FlexPro therefore uses the standard symbol Ω for the unit.

ChangeUnitSymbol(Spectrum, , "1/s")

Only the unit symbol of the signal's X component is changed. The unit symbol of the Y component remains unchanged.

ChangeUnitSymbol(1 Hz, "1/min")

Results in an error message because the specified unit symbol does not match the existing unit.

See Also

ChangeUnit Function

Unit Manager

Quantities in FPScript

Share article or send as email:

You might be interested in these articles