ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linear Fit errors

Solved!
Go to solution

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):
  1. You have only a two-column file. In this case you need columns 0 and 1 (column 2 does not exists) error -20002
  2. 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?



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 1 of 5
(5,062 Views)
Solution
Accepted by topic author J.Mamakos

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.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 5
(5,053 Views)

@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!



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 3 of 5
(5,049 Views)

Most of the time, a simple error lookup will tell you exactly where you went wrong.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 5
(5,046 Views)

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!



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 5 of 5
(5,043 Views)