04-03-2009 09:26 AM
Relatively new to the .NET languange. We are attempting to convert a VB6 app over to .NET. The VB6 application uses CWStat ActiveX controls. Is there some library that is similar to what the CWStat function did?
04-06-2009 11:20 AM
Hi,
In your project properties, set a reference to the "NationalInstruments.Analysis.Enterprise" .NET library
import the math functions
add this to the statement to your form or module.
Imports NationalInstruments.Analysis.Math
that will expose all the functions you'll need. Check the object browser
ex
Dim average As Double
Dim myData(100) As Double
'load array with data
average = Statistics.Mean(myData)
Hope this helps
Curt
04-06-2009 11:31 AM
Shop,
Measurement Studio has a very good analysis library that includes RMS. The .NET Class analysis library for (C# .NET and VB .NET) that includes RMS value comes with both the professional and enterprise versions of Measurement Studio. You need to add a .NET reference to "National Instruments Analysis <Professional/Enterprise>" in your VB project and the you should be able to use Statistics.RootMeanSquared Method (double[]). If you run into any problems please feel free to post back to this forum.
04-07-2009 07:42 AM
In the .NET example, ContAcqVoltageSamples_IntClk_ToFile, I have tried adding the references and code above but I am still getting errors. In this particular example, it takes 100 samples per channel at a rate of 100Hz and writes the readings to a file. I added a textbox and I simply want to display the average voltage of ALL the readings. This was easily done in VB6 with CWstat.Mean. The example acquires data in the sub AnalogInCallBack(ByVal ar As IAsyncResult) and puts it into a variable named "data". The variable is dimensioned as Private data(,) as Double. How can I get this data over to a usable array to analyze it?
Thanks
04-07-2009 04:41 PM
I don't know what version of Measurement Studio you have, but you could check out this example i just made, and put in the new Community Examples. You can get the waveform data into an array of doubles using waveform.GetScaledData().
Dim values_array() As Double
values_array = waveform.GetScaledData()
NumericIndicator.Value = Statistics.Mean(values_array)