Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

The input arrays do not contain the correct number of data values for this functin

I got the data from the DataSocket ant want to plot the wave and its spectrum,but i got Error Message:
The input arrays do not contain the correct number of data values for this functin

Private Sub CWDataSocket1_OnDataUpdated(ByVal Data As CWData)
'When an update is received OnDataUpdated is fired.

Dim AmpSpectrum As Variant
Dim PhaseSpectrum As Variant

Dim dt As Variant ' amount of time per sample
Dim df As Variant ' df will be the frequency

Dim ptsPerScr As Integer
Dim scanRate As Integer
Dim chNum As Integer



scanRate = Data.GetAttribute("scanRate", 10000).Value

dt = 1 / scanRate

I
f (IsArray(Data.Value)) Then
CWGraph1.PlotY Data.Value

'plot the spectrum
CWDSP1.AmpPhaseSpectrum Data.Value, 1, dt, AmpSpectrum, PhaseSpectrum, df
CWGraph2.PlotY AmpSpectrum, 0, df

ElseIf (IsNumeric(Data.Value)) Then
CWGraph1.ChartY Data.Value
End If
End Sub
0 Kudos
Message 1 of 3
(2,424 Views)
Hello

Which function is returning this error? Is it the ploty or the ampphasespectrum function?you might want to double check and see if you have all the data that you want to analyse and whether the analysis function is returning the adequate number of points. If you think this has to do with the number of points, try using a dummy array that is the same size as the datasocket array you are sending and see if that causes the same problem.

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 3
(2,424 Views)
AmpPhaseSpectrum ,this function cause this error.
i write data to datasocket by using the following sentences

hr = DS_SetAttrValue (dsHandle, "ptsPerScr", CAVT_LONG, &ptsPerScr, 0, 0);
hr = DS_SetAttrValue (dsHandle, "scanRate", CAVT_LONG, &tpTyroProject->Acq.AcqRate, 0, 0);
hr = DS_SetAttrValue (dsHandle, "chNum", CAVT_LONG, &tpTyroProject->EnabledChNum, 0, 0);
hr = DS_SetDataValue (dsHandle, CAVT_DOUBLE|CAVT_ARRAY,data ,
tpTyroProject->EnabledChNum,ptsPerScr );
0 Kudos
Message 3 of 3
(2,424 Views)