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

Hi,

 

I know this is an old thread. But, I have been trying to calculate average of a channel and copy to a variable.

I have tried this statement. Call Calculate("average=CCh(36,0)")

But, I keep getting an error 'Cannot assign the calculation result to the left side of the formula'

Can you please help me with it?

RishiDivakar_0-1622902147671.png

 

Certified LabVIEW Architect
System Test Architect
Electrical Engineering
JLR
0 Kudos
Message 31 of 33
(1,413 Views)

Hi Rishi,

 

Any variables in the formula of the Calculate() command have to be global DIAdem variables.  You can use the existing temporary variables such as L1, R1, T1, ... or you can elevate any VBScript variable to global status with the GlobalDim command:

GlobalDim "average"
Call Calculate("average=CCh(36,0)")
MsgBox average

 

You could alternatively call the statistics command in the ANALYSIS panel (parametrized to calculate the average) and access the global variable it fills for the average calculation

Call ChnStatisticsChannelCalc(36, eStatsArithmeticMean)
MsgBox StatsResult(eStatsArithmeticMean)

Brad Turpin

Principal Technical Support Engineer

NI

0 Kudos
Message 32 of 33
(1,398 Views)

Hi Brad, Thanks so much. I have used the calc functions.

 

For future references, please find below code snippet.

 

Set ChnResult = ChnSavitzkyGolayFilter("Dummy", "Median", 4, 200)
call ChnStatisticsChannelCalc(oMyChn, eStatsArithmeticMean)
X1value=StatsResult(eStatsArithmeticMean)

Certified LabVIEW Architect
System Test Architect
Electrical Engineering
JLR
0 Kudos
Message 33 of 33
(1,382 Views)