From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

MathScript

I am trying to use a MathScript node in a simple test VI that fits a 2D Gaussian function to some imported data. The fitting function appears to work fine, but when I try to use the 'lsqfit' function I get the following error:

 

"Error -90046 occurred at Error in function lsqfit at line 7:  The input parameters are not in the required format."

 

As far as I can tell all the inputs are in the correct format, and if I comment out the function call to 'lsqfit' the VI executes fine. I've attached my VI file, my fitting function file (as a .txt file), as well as some sample data. What am I missing here?

Download All
0 Kudos
Message 1 of 3
(6,195 Views)

Hi,

 

The lsqfit function requires that xdata and ydata are 1-D arrays of the same size. In your script, x has 150 elements while y has 22500 elements. Then, the function returns error.

Message 2 of 3
(6,182 Views)

Ah, that makes sense. Thank you for pointing that out. I'll make the correction tomorrow. It would be nice if LabVIEW gave more descriptive error messages.

0 Kudos
Message 3 of 3
(6,178 Views)