can i please know the method for this condition.
1st row value of ADC matrix should compare with ADC_LUT matrix and take the next higher and lower value.
for eg-if 3996 from ADC matrix is compared with ADC_LUT matrix , it should take out 3997 & 3968 value from ADC_LUT matrix.
similarly for other value to.
Am doing the interpolation here to find out the temperatures (4x0 matrix) for corresponding values in ADC matrix ,can i please know the method for this condition.
1st row value of ADC matrix should compare with ADC_LUT matrix and take the next higher and lower value from that ADC_LUT matrix and corresponding temperature values from temp matrix and find the desired temperature for eg-if 3996 from ADC matrix is compared with ADC_LUT matrix , it should take out 3997(g1) & 3968(g3) value from ADC_LUT matrix and corresponding temperature i,e -40(t1) & -35(t3) from Temp matrix and interpolate the temperature t2 using the above attached formula for value 3996(g2).
similarly for other values of ADC matrix (4x0) automatically it should compare.
In case g2=3831 the calculation of g3 must fail because there is no smaller value in ADC_LUT.
We can deal with that case with a try and catch and return NaN for this value:
P5 worksheet attached.
P.S.: If you meant g3<=g2 instead of g3<g2 as you wrote, then you have to replace "lt" by "leq" and can do without the extra function.
Oops, stop! bad idea. You may end up with g1=g3 and this would result in a division by zero. So you should come up with another idea to deal with that case.
Wouldn't it be natural to just use the temperature from temp as it is if the value is exactly in ADC_LUT ?
P.P.S.: For the future - please attach your worksheets, not just pictures!