NI DIAdem Custom Channel Properties and Results of Statistical Calculations

Updated Jun 12, 2023

Reported In

Software

  • DIAdem

Issue Details

When performing a statistical calculation of data channel or its part in NI DIAdem versions up to 2017 it was possible to view the results of the calculations under Custom properties of the given channel. In newer versions of DIAdem, this option is available only for the whole channel and not for its part. 

Solution

Let us run the following script in DIAdem 2017 and 2021:
Set ChnResult = ChnLinGen("/LinearGenerated", 1, 100, 1000, "")
Call ChnStatisticsChannelCalc("[1]/LinearGenerated", eStatsArithmeticMean, 1, 100, False, False, False, "NameName")
The first line will generate a data channel with 1000 elements with a minimum equal to 1 and a maximum equal to 100. 
The second line will perform an Arithmetic mean calculation for the first 100 elements in the data channel. 
In DIAdem 2017 the calculation result could be found in Data Portal>LinearGenerated>Custom properties>Result>Mean Values. Please see the screenshot below:

Diadem.jpeg
 In DIAdem 2021 the same script will perform the same calculation, however, when looking into the Data Portal for the Result we will see that there is no Custom Properties Field and as a consequence also the Result of the calculation. 
However, if DIAdem 2021 runs the following script:
Set ChnResult = ChnLinGen("/LinearGenerated", 1, 100, 1000, "")
Call ChnStatisticsChannelCalc("[1]/LinearGenerated", eStatsArithmeticMean, 1, 1000, False, False, False, "NameName")

It will calculate the arithmetic mean for whole channel, and we can find the Custom Properties>Result in the Data Portal
In order to View or use the result of the calculation in newer versions of NI DIAdem performed for a certain number of elements, there are the following options:

1. Add the following line after the script:

MsgBox "Mean = " & StatsResult(eStatsArithmeticMean)

This will throw a Message Box with the results.

2. Change one of the arguments in the second line of the script from "False" to "True":

Call ChnStatisticsChannelCalc("[1]/LinearGenerated", eStatsArithmeticMean, 1, 1000, False, True, False, "NameName")

This will create a new channel with the result.