Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I create an array of times to go with the data returned from the CWAI ActiveX control?

I have been able to get the data and plot it, but on its own it's pretty useless as PlotY (in the documentation demo) only plots the values against the scan number.

How can I create a second array of time values to pass to PlotXY with the data?

I tried using a for loop to create the time array. This worked, I then created another array as follows:

xyData = Array(times,AcqData)

where AcqData is from the Read Function and Times is my array of times.

I was sure this would work, but I got the error message 'Array Dimension Mismatch'.

In my code:

CWAI1.Read 96000, AcqData, ReadSpec

and the time array is made using:

TimeInterval = 1 / 96000


ReDim Times(96000)
Times(0) = 0
For t = 1 To 96000 - 1
Times(t) = t * TimeInterval
Next t

xyData = Array(Times, AcqData)

Does anyone know what this is happening?
0 Kudos
Message 1 of 3
(3,691 Views)
I am a little confused about the "xyData = Array(Times,AcqData)" line in your code, but if you would like to combine two same-length 1-D arrays into a single 2-D array for processing by the CWGraph.PlotXY()function, I would recommend you use the CWArray.BuildArray() function. The only requirement for this is that the two inputs are of the same length, which can be checked via the function CWArray.ArrayDimSizes(). There is a useful piece of example code attached to the BuildArray help file in the Measurement Studio Reference Browser that should assist you.

Elaine R.
Applications Engineer
http://www.ni.com/ask
0 Kudos
Message 2 of 3
(3,691 Views)
I don't have the CWArray control as I don't have measurement studio. I'm just using what I found listed in my ActiveX toolbox - some controls are just demos.

The code was trying to create an array of arrays if that makes sense. I thought since AcqData was an array of the data I could Make an array of times, then combine them in a single array called xyData - hence xyData = Array(Times,AcqData) where Times and AcqData are both arrays.

Similarly I only have documentation which is available through the object browser in VB. And I'm just using VB5 CCE (Free from Microsoft) and Microsoft Access/Excel 2000 with VBA.

Is there another way to acheive this?
0 Kudos
Message 3 of 3
(3,691 Views)