Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

copy NIVector to double array

Hi,

is there an easy way to copy data from an CNIReal64Vector to a double array?

I tried to use the STL copy algorithm, but the tricky thing is that I have to copy the last element myself. Ugly...

The method gets a pointer to an array : double* autoSpectrum1[]

CNiReal64Vector niAutoSpectrum;
MathError errorNI = CNiMath::AutoPowerSpectrum(timeDataVector, niAutoSpectrum, df, dt);

size = niAutoSpectrum.GetSize();
*autoSpectrum1 = new double[size];
std::copy(&niAutoSpectrum[0], &niAutoSpectrum[size-1], &(*autoSpectrum1)[0]);
(*autoSpectrum1)[size-1] = niAutoSpectrum[size-1];

Any idea?
Thanks
 Mario

0 Kudos
Message 1 of 2
(5,257 Views)
Hi Mario,

Here your "double* autoSpectrum1[]" is a table of pointer.
When you have, you can do is to do a "For Loop" and copy the element of the table pointed from your "autoSpectrum1" table and save it in a 2D table...

I think that is the best way to do that...

Regards...

Matthieu

0 Kudos
Message 2 of 2
(5,254 Views)