Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to transfer data from CNiReal64Matrix to CNiReal64Vector?

Hi guys,

I'm new to meassurement studio and C++.

now i got a CNiReal64Matrix signal from my DAQ card.

ex:

// 

CNiReal64Matrix ReceiveData;

m_reader->ReadMultiSample(1000, ReceiveData);

//

and I have to use CNiReal64Vector to do some analysis.

ex: PowerSpectrum(), FFT(), RMS() etc.

 

I'm trying this:

CNiReal64Vector myWave(ReceiveData);

then I could do RMS(myWave);

 

but I wonder there are some another way to do that or I have to declare lots of vars.

 

Thanks a lot.

 

br,

 

 

0 Kudos
Message 1 of 2
(6,778 Views)

When converting a matrix -> vector type, the channel count and data count ( #of samples) are separated by using the GetRows() & GetCols(), respectively.

Say your matrix, has a sample size of 100 derived from channel ai0 - > ai1. 

 

CNiReal64Matrix voltageMatrix;

 

int channelCount = voltageMatrix.GetRows();

int dataCount = voltageMatrix.GetCols();

 

CNiReal64Vector voltageVector;

 

for (int i = 0; i < dataCount; i++) {

 

       voltageMatrix.CopyColumn(i, v);

       ........   

       ........

 }

 

 

work out the channel count part so you can cover all channels.

0 Kudos
Message 2 of 2
(6,700 Views)