DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you do an average of only ONE channel in analysis?

Solved!
Go to solution

How do you perform the "average" function in analysis using only one channel? Currently I must do this by hand in the .csv file that I import to Diadem. I'd prefer not to do this because of scripting.

0 Kudos
Message 1 of 33
(10,389 Views)

Hi shredderjohn,

 

First of all, is that a Bloom County reference (Cutter John)?  The first function in the "Statistics" palette in ANALYSIS is called "Descriptive Statistics"

Descriptive Statistics Dialog

 

Once you drag the channel you want to calculate the average of into the "Channels:" field at the top, deselect all the checkboxes except the "Arithmetic mean" and hit the "OK" button.  This will create a new property in that channel called "ResultStatArithMean" at the very bottom of that channel's property table in the Data Portal.

 

How are you loading your *.CSV files?  Are you already using a DataPlugin?  If your data files aren't too big, it might be easier to just have the DataPlugin calculate the average for you.  Feel free to post a data file, and I'll take a look at that possibility for you.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 33
(10,383 Views)

Brad, No reference to Bloom County. This company manufactures "shredders" primarily for the recycling industry. They can reduce a car to less than fist size pieces in about 20 seconds. We also have technologies to extract and seperate the non-ferrous materials as well, hence "shredderjohn.

 

Your answer was spot on! Allow me to ask another, how do I round to a whole number the result of "arithmatic mean"?

0 Kudos
Message 3 of 33
(10,364 Views)

Hi shredderjohn,

 

Wow, that's some serious shredding.  The simple answer to your question is to use the "Round" function.  Now tell me how you want to use that "Arithmetic_mean" property-- as an expression in REPORT/VIEW or as a variable in a VBScript?

 

Brad Turpin

DIAdem Product Support Engineer 

National Instruments

0 Kudos
Message 4 of 33
(10,355 Views)

I see the round function but being a novice programmer I am not sure of how or where to use it. I am using this right now, @@CMax(), in a text to pull a number produced by the method you gave me before. I have tried to put the round function in there but so far no luck. Here is another one for you. I am using script with some success automating reports. I cannot get the channel info to pull onto a reports page. An example is a 2D chart showing hydraulic pressures over a period of six hours. I can do it manually by selecting "time" and then the channel and drag it over. Those manual steps don't show up in the script. I know I am missing some procedure to have those steps automate in script.

0 Kudos
Message 5 of 33
(10,351 Views)

I have the script issue solved but still need help with "round".

0 Kudos
Message 6 of 33
(10,348 Views)

shredderjohn,

 

I have no clue how you can reduce the size of a car so quickly, but it sounds awesome! 

 

To round a data set, you will want to use the calculator

 

calc.png

 

and use the Round operation or you could enter something similar to the following eqation into the top portion of the calculator:

 

Call FormulaCalc ("Ch('Group2/Result'):= Round ('Group1/Input')").

 

To find out more about the Round function, open Diadem and navigate to Help » Contents and search for "round"

 

help.png

 

Note: Double click any of the Operations (such as Round) or Channel Names to insert them into your equation.

Regards,

Shawn S. | NIC
Instrument Driver/IVI PSE
National Instruments
0 Kudos
Message 7 of 33
(10,347 Views)

It works fine in the calculator. This is what I have

 

Round(CMax(86))

 

I click calculate and the whole integer appears.

 

I want this to function in a script. I am averaging a channel and calling that result into a text area in a report by using @@(CMax (86))

 

It also works fine. Where in the .vbs line should I put the Round function? I have tried inserting it after the last ine of the "analysis" to no effect.

I also tried to insert it before the script calls the report.

 

The shredder works so well because it is a 6000 HP electric motor turnng a rotor that is about 80" by 109" with 14 hammers weighing 410 lbs each at about 500 RPM. Yup, it is damn violent!!

0 Kudos
Message 8 of 33
(10,336 Views)

It seems I need to calculate the average THEN assign it to a variable THEN call the variable to the text in the report. Yes??

0 Kudos
Message 9 of 33
(10,333 Views)

Hi shredderjohn,

 

No, if you just want to reference the rounded average in a REPORT text box, say, then the easiest way would be to use an @@ expression, like this:

 

Average = @@Round(Data.GetChannel("[1]/ChannelName").Properties("ResultStatArithMean").Value)@@

The "Arithmetic mean"  calculation automatically adds the "ResultStatArithMean" property to the data channel whose vazlues were just averaged.  You can reference that new property and piggy-back the Round() function in one @@ expression-- just substitute your actual channel name instead of "ChannelName" above.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 10 of 33
(10,329 Views)