Applying FPScript Functions to Data Sets

23.08.2021

Often, identical calculations have to be performed for a variety of data sets. One way of automating this process is to save the data sets in different subfolders and to activate the folder from which the data for an analysis is to be taken.

The second option, which is described here, is to pack the calculation rule into an FPScript function and then to use this as a template for generating new formulas.

FPScript offers you the option of programming formulas with arguments. You can then use these formulas like functions. A Normalized formula, which normalizes your argument to a range of values from 0 to 1, looks like this, for example:

Arguments Data
Data / Maximum(Data)

You can now use this function in other formulas. For instance, you can add a SignalNormalized formula containing the following code:

Normalized(Signal)

It is very easy to create these types of formulas with FlexPro. You only have to click on the data sets to which you would like to apply the function, use your mouse to select them from the Object List and drag them onto the function in the Object List. If you drag just one data set to the function, FlexPro then adds a new formula that applies the function to this data set. When you drag multiple data sets to the function, a dialog box appears where you can choose whether to create a formula like this for each data set, or whether to create only one formula that bundles all data sets into a list and with that calls the function.

In the example above, drag the Signal data set to the Normalized function in the Object List. FlexPro will then automatically add a new formula named SignalNormalized which contains the code specified above. You can then use this new formula for further calculations or for displaying in documents.

You can also use functions with several arguments. In this case, the first argument used is the data set that you dragged onto the function with the mouse. You can specify additional arguments in a dialog box.

See Also

Formula

Creating Templates for Analysis

Share article or send as email:

You might be interested in these articles