# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Calculate values of array with a function (depending on the values)

Hi,

I am looking for a Way to calculate each value of an array with a function and then output the new array. My problem is, that the function refers to the values of the array. So far it only calculates the first value of the array and puts it in a column of the calculated array. The formula is the following: E(New) = C0 + C1*E + C2*E^2 + C3*E^3 + C4*E^4. (Array is filled with varying E)

I read how you can multiply the array with a constant, but could not find a similar problem to my case. I am sure I am overseeing something but can't figure it out.

Any help appreciated. The VI is attached

Message 1 of 5
(1,508 Views)
Solution
Accepted by topic author Phil7

## Re: Calculate values of array with a function (depending on the values)

Hi Phil,

why don't you use the polynomial functions provided by NI?

Btw. your DAQAssistent only has one channel/signal defined, so using SplitSignal afterwards is pure nonsense!

Best regards,
GerdW

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(1,485 Views)

## Re: Calculate values of array with a function (depending on the values)

Because I did not know of it. Thank you, works great.

I seperated the signal so I can do the calculation on my array. Does the vi you presented also accept the signal as input?

Message 3 of 5
(1,455 Views)

## Re: Calculate values of array with a function (depending on the values)

Hi Phil,

@Phil7 wrote:

I seperated the signal so I can do the calculation on my array.

No need to separate a single signal from a DDT wire containing only this single signal…

@Phil7 wrote:

Does the vi you presented also accept the signal as input?

The FOR loop accepts the signal as is shown in the snippet.

I guess I don't understand this question…

Best regards,
GerdW

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 5
(1,433 Views)

## Re: Calculate values of array with a function (depending on the values)

@GerdW wrote:

I guess I don't understand this question…

@Phil7, I think what GerdW was trying to say was that the Split Signal "Splits two or more signals into component signals."

(@GerdW, please correct me if I'm wrong. 😊)

So, if you only have one input signal, it doesn't make sense to Split it - just feed it directly into the "Convert From Dynamic Data" (or "Von dynamischen Daten konvertieren", in your case). Like this:

If  you need to combine the two signals in your output, you can just branch the wire and then feed it into a "Merge Signals" like you have already done:

Does that make sense?

-joeorbob

Message 5 of 5
(1,424 Views)