DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Script

Solved!
Go to solution

Hi say,

 

I get the same error you report when the ChanName string can not be found at least 2 times in the Data Portal.  Here's a version that checks for that and logs the issues in the log file (below the script in the SCRIPT editor).

dim ChanList, ChanNames, ChanName, ResultGroup, ResultChannel
ChanNames = Array("force", "force_xyz", "Energy")
set ResultGroup = Data.Root.ChannelGroups.Add("Results")
Call ResultGroup.Activate()
FOR Each ChanName In ChanNames
set ChanList = Data.GetChannels(ChanName)
IF ChanList.Count > 1 THEN
set ResultChannel = ResultGroup.Channels.Add("Mean_" & ChanName, DataTypeChnFloat64)
call ChnAverage(ChanList, ResultChannel)
ELSE
LogFileWrite "Couldn't find enough channels of type: " & ChanName
END IF
NEXT ' ChnName

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 11 of 13
(783 Views)

Hello Brad,

Thank you for your answer , the script is now running , but i think that it doesn't calculate the mean, i only have one case named "result : as you can see in the figure attached : 'result')

However, i tried another script ( attached in the other figure named : another script') provided by Dia 791, what do you think about it? i think that it works 

Download All
0 Kudos
Message 12 of 13
(773 Views)

Hi say,

 

Your original request was for "the mean of three test[s]".  I understood you to want to calculate the mean of N channels that all shared the same channel name but were stored in N different groups.  That's what the script I sent you does-- you get one result channel for each original channel name.

 

If this is not what you're after, please try again to explain what you want.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 13 of 13
(716 Views)