DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Descriptive Statistics - From Time X to Time Y

In DIAdem 2017 we were able to calculate statistics for a given channel in a specific window (using the "From Row" "To Row" boxes) and then push those values to the channel properties.

 

In DAIdem 2018 these statistics values can not be pushed to the channel for the specified window, only for the entire channel length.

 

What is the deal with this change? 

0 Kudos
Message 1 of 5
(404 Views)

Hi Brian,

 

Thanks for bringing this up. I was able to replicate this and want to run it by our R&D team to get some insight into this behaviour.

 

Justin

0 Kudos
Message 2 of 5
(369 Views)

Hi Brian,

 

The story from R&D is that writing statistical properties to the data channel was never supposed to happen in DIAdem 2017 when there was a row range specified that is different from all the rows in the channel.  The philosophy is that those properties, when written, always contain the statistics from the full channel.  R&D corrected this "mistake" in DIAdem 2018, introducing the incompatibility.

 

The philosophy here is that the specific row range is not recorded, so it's unclear what those properties mean.  R&D wanted those properties to unambiguously mean the statistical calculations over the whole channel.

 

If you're running the calculation in a VBScript and using the older StatBlockCalc() command, you can use the returned global variables, such as StatArithMean, to programmatically create properties or channel values that contain these metrics. 

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 3 of 5
(292 Views)
Highlighted

Hi again Brian,

 

Quick addendum.  If you're using the newer ChnStatisticsChannelCalc()  or  ChnStatisticsBLockCalc()  functions, then you can request the scalar result of a particular statistics calculation using the StatsResult() function, that takes as its argument the same enumeration integer that you use to specify which statistical values get calculated, like this:

 

Call ChnStatisticsChannelCalc("[1]/Speed", eStatsArithmeticMean, 500, 800)

MsgBox "Average = " & StatsResult(eStatsArithmeticMean)

 

The description of the StatsResult() function and the StatsPropertyName() function were missing from the Help system until DIAdem 2018 SP1.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 4 of 5
(284 Views)

Hello Brad,

 

Sometimes search is perfect and you find your use case first try.  This was one of those days!  So thanks for posting this.

 

Just want to clarify this function the documentation calls something like:

Set chnResult = ChnStatisticsChannelCalc(thisCh, eStatsArithmeticMean)

 

If I call this and use your helper StatsResult(eStatsArithmeticMean), I get average of the channel but the returned object chnResult has a count property of 0 for the elementList.  So there is no use to this return object as its collection is size 0.  Is the documentation wrong here too or how do we use this return object?  Wrong cast or something?

 

Also, if I call Set chnResult = ChnStatisticsChannelCalc(thisCh, eStatsArithmeticMean, startIndex) an error is thrown. saying syntax for the line number is wrong...

Set chnResult = ChnStatisticsChannelCalc(thisCh, eStatsArithmeticMean, startIndex, thisCh.Size) runs ok and calculates the mean over the subset.  So the documentation needs to be updated here too?

 

StatsResult does not highlight either shouldn't it highlight since it is a built in function?

 

Thanks again.

0 Kudos
Message 5 of 5
(92 Views)