Showing results for 
Search instead for 
Did you mean: 

Working with Results of StatBlockCalc


Working with Results of StatBlockCalc

I'm trying to work with the results of a call to StatBlockCalc to several channels and was hoping to do it efficiently without creating a new channel. The script I'm trying to create would ideally do the following:

  • Determine a subset of rows to analyze that are a given number of rows apart, for instance every 720 rows (1,721,1442,2163, etc)
  • Calculate the mean value for this subset of rows for each channel in a channel group (could vary from 10-20 channels)
  • Put the result in a vector variable so that I could access each channels mean value (i.e. meanVector(3) would access the mean value for the third channel)

I need to call this several times for different subsets of rows (in my case 720 times) such that each subset looks like:

  • 1, 721, 1442, 2163, ...
  • 2, 722, 1443, 2164, ...
  • 3, 723, 1444, 2165, ...
  • ...
  • 719, 1441, 2162, ...

So I'd prefer not to have to create 720 new channels and then delete them or call StatBlockCalc 720 times for each channel.


My current code that just makes new channels (but is slow) looks like:


For iLoop1 = 1 to 720
      'sRows is a function of iLoop1  
      Call StatBlockCalc("Channel", sRows, ChnList)
      sMeanChn = "[" & iAvgIndex & "]/ArithmeticMean"
      Set oMeanChn = Data.GetChannel(sMeanChn)
      'Do something with oMeanChn

I tried using the solution in this post:, but it seems the only way the ResultStatArithMean property is created is if the rows are set to "1-"


Is there any way that I can avoid creating and deleting 720 channels?

0 Kudos
Message 1 of 2

Re: Working with Results of StatBlockCalc

Hi meatballosaurus,


At the bottom of that link you mentioned there is a long list of the global variables populated every time the StatBlockCalc() command is run.  You just need to read out the value from, say, the StatArithMean variable and save it to the target array variable you want to fill.


Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 2