I would like to calculate the least-squares slope and intercept of a 2d array of numbers during a continuous analog input measurement, in order to scale that input.
If I extract the x and y arrays using 'Index Array' and then use the 'Linear Fit Coefficients.vi', I can get the slope and intercept, but if I subsequently change the array elements, no recalculation of the slope and intercept occurs.
Alternatively, if I place the 'Linear Fit Coefficients.vi' etc inside an event structure inside a while loop, the slope/intercept are calculated when the array is changed, but not when the VI is first executed.
How can I process the array as soon as the VI commences AND when the array is changed?