09-17-2012 10:08 AM - edited 09-17-2012 10:08 AM
I am trying to make use of the "Linear Fit" and "Linear Fit Coefficients" vi's, but I am getting errors despite inputting what I thought was correct. If I connect my two 1D data arrays to the 'X' and 'Y' input terminals then I get the error -20002. If I connect empty arrays, I get the error -20006. I'm leaving all the other inputs unconnected.
In looking for a solution to this, I came across something altenbach said a few years ago:
@altenbach wrote:
Some possible errors that can occur with linear fit (but they would generated different error codes):
- You have only a two-column file. In this case you need columns 0 and 1 (column 2 does not exists) error -20002
- You have only one row, thus only one data point. error -20006.
I only half-understand what he meant, and/or how it would apply to what I'm doing wrong. Can anyone help me out here?
Solved! Go to Solution.
09-17-2012 10:17 AM
Please attach code.
-20002 states that the input sequences must be the same size. So X and Y need to be the same length. Verify this first.
-20006 states that the input lengths must be at least 2 elements. So passing in empty arrays makes perfect sense here.
09-17-2012 10:25 AM
@crossrulz wrote:
-20002 states that the input sequences must be the same size. So X and Y need to be the same length. Verify this first.
One of my arrays was an element short (I was taking the arrays from different ends of a For loop). Thanks for showing me where to look!
09-17-2012 10:27 AM
Most of the time, a simple error lookup will tell you exactly where you went wrong.
09-17-2012 10:29 AM
I didn't know you could do that (aside from looking on the internet). I've found the "Explain Error" option now that I look for it. Thanks again!