Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem: AnalogWaveform double, not real double

Hi I am quite newbie in measurement std. Just installed and started working with my 6008. Use the GUI to setup my 1 in analog channel and displays the waveform.. beautiful, my data form the device is in a type "AnalogWaveform<double>", which is required by the "Read()" function.. But now a what to do a fft which requires a double[], hence my data should work... Now the template "AnalogWaveform<double>" sould be a double but I get the error message "Cannot convert from AnalogWaveform<double>[] to double[]" Doesn't make sence. I've tried everything, using the DataConverter etc. to get it to a double, but nothing helps. I cant even display the content of the array, it claims length 1 - very frustrating Regards Simon
0 Kudos
Message 1 of 10
(7,736 Views)

private

void start_Click(object sender, EventArgs e)

{

//double[] acquiredData = daqTaskComponent1.Read();

AnalogWaveform<double>[] acquiredData = daqTaskComponent1.Read();

//double [] acquiredData2 = daqTaskComponent1.Read();

 

Tremor.PlotWaveforms(acquiredData);

Sampledata.Text = acquiredData.Length.ToString();

//DataConverter.Convert(acquiredData, typeof(double[]));

//System.Double [] data = DataConverter.Convert(acquiredData, System.Double);

//Console.WriteLine(acquiredData.ToString());

Transforms.RealFft(acquiredData);

//Transforms.PowerSpectrum(acquiredData);

//Tremor.PlotWaveforms(acquiredData);

}

0 Kudos
Message 2 of 10
(7,735 Views)
Call AnalogWaveform.GetRawData(). So, instead of calling DataConverter call aquiredData.GetRawData()
 
Brock
0 Kudos
Message 3 of 10
(7,729 Views)

Thanks, however it claims not to have a definition for GetRawData() I checked the class definition and can see that it ougth to. I've added all the references etc. Actually non of the methods etc. defined in the class is avaliable, it's rather wierd. dont know if u've experienced similar.

 

Regards

Simon

0 Kudos
Message 4 of 10
(7,720 Views)
I get the errormessage: System.Array does not contain a definition for GetRawData. for the code:

//double[] acquiredData = daqTaskComponent1.Read();

NationalInstruments.

AnalogWaveform<double>[] acquiredData = daqTaskComponent1.Read();

//double [] acquiredData2 = daqTaskComponent1.Read();

Tremor.PlotWaveforms(acquiredData);

double[] data = acquiredData.GetRawData();

//Sampledata.Text = acquiredData.Length.ToString();

 

It apears that it is interpreted as the AnalogWaveform should be a System.Array ??

Regards

0 Kudos
Message 5 of 10
(7,718 Views)
The GetRawData() function of AnalogWaveform<double> class gives you the actual double[] values stored in the waveform.

You have


NationalInstruments.AnalogWaveform<double>[] acquiredData = daqTaskComponent1.Read();


You should call the GetRawData() function on the required AnalogWaveform<double> and not on acquiredData, which is an array. So, if you want to get data from the first analog waveform, you should probably do


double[] data = acquiredData[0].GetRawData();

Mahesh

Message Edited by mherle on 03-02-2007 05:02 AM

-Mahesh
National Instruments
0 Kudos
Message 6 of 10
(7,711 Views)
Thanks;o)
0 Kudos
Message 7 of 10
(7,705 Views)

I cannot do a

  

convertdata.convet(data, oftype(double))

 

data is of type analog waveform.

 

It gives me the error that double cannot be an argument.

 

What is the most simple way to get the voltage from the hardware into a csv file? I already have created the file and am able to write to it, I just keep getting the output System Double[] when i try the above code.

0 Kudos
Message 8 of 10
(6,779 Views)

When I use

   double[] data = acquiredData[0].GetRawData();

 

I get a System Double[] returned. What am I doing wrong?

Message Edited by talltubatom on 06-05-2009 06:35 AM
0 Kudos
Message 9 of 10
(6,764 Views)

You aren't doing anything wrong.

double is the C# keyword that means System.Double. System.Double is the actual data type in the .NET Framework Common Language Runtime.

 

 

Here is a link to the MSDN documentation that states this - http://msdn.microsoft.com/en-us/library/678hzkk9(VS.80).aspx.

 

 

If you want to do some reading that provides this kind of background information on .NET and C#, I (personally) highly recommend the book "CLR via C#", by Jeffrey Richter.

 

 

David Rohacek

National Instruments

0 Kudos
Message 10 of 10
(6,742 Views)