LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find best fit of number

Hello,
can someone help me with this problem:

I have a numeric-double-control as input.
Then i have a numeric-double-array-constant with ~10 numbers.

The output should be one of the constant-numbers which is the nearest to the input-number.

For example:
input: 2.7
constant-array: 0.1 / 0.7 /2.1 / 3 / 5.5 / 9

The the ouput should be: 3

Thanks for your help
0 Kudos
Message 1 of 4
(2,932 Views)
Hi NewOne:

I think you want us to solve your exercise.

Try explaining the way you think it can be done, and if it is not correct someone can tell you where the problem is.

Have you tried to substract them and find de lowest in absolute?

Aitortxo.
Aitortxo.
0 Kudos
Message 2 of 4
(2,928 Views)
Hello Aitortxo,
I already did it like you said but i thought there woul be an easier/faster way to do it than searching an array.


0 Kudos
Message 3 of 4
(2,922 Views)

What about this one?

Hope it helps.

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 4 of 4
(2,912 Views)