Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

LinFit

I have two C++ arrays for example:
double *array1 = [1.2, 1.5, 2.0, 3.5];
double *array2 = [6.0, 7.0, 7.5, 8.2];

how do I pass this arrays to LinFit? LinFit takes
variants as arguments.

Thanks.
0 Kudos
Message 1 of 4
(3,161 Views)
Sorry, forgot to mention that LinFit is a method of CWStat.
0 Kudos
Message 2 of 4
(3,161 Views)
Since you're using C++, you might want to take a look at the CNiMath class from Measurement Studio for C++. It has a LinearFit method that would be easier to use with C++ data types than CWStat.

- Elton
0 Kudos
Message 3 of 4
(3,161 Views)
I found the solution to my problem and it was easy! (but it drove me nuts to find it!)
simply, declare a COleVariant, set it's vt to VT_BYREF | vt_R8 and set its pdblVal to the array. See code below:
COleVariant x;
x.vt = VT_BYREF |VT_R8;
V.pdblVal = array1;

// do the dame for array2
0 Kudos
Message 4 of 4
(3,161 Views)