LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For loop/formula node/shift register_Beginner question

Solved!
Go to solution

Hello,

I'm a Labview beginner and have a beginner question. I think it's for most of u very easy, so please try to help me soon:)

I have (X,Y) datavalues.. I calculated the arithmetic mean using a formula node and a for loop and got (X',Y') out. Now, I want to take the output X' and Y' and calculate a mean value in reference to X and Y. So, the same calculation in the for loop but i want to take the output values and feed it in again as input values. This should be performed N times and plotted.

I tried to use shift registers, but failed to connect it correctly that i can get what I want. I attached here this part of my vi where I have the problem. I hope that you can help me. thanks in advance.

0 Kudos
Message 1 of 14
(3,749 Views)

Hi Sarah,

 

what's the reason to use formula nodes at all for such simple calculations?

You don't even need FOR loops - see attachment…

 

but i want to take the output values and feed it in again as input values.

Please define the next step(s): which values should be averaged in the 3rd/4th step?

Do you want to average X'' with X', then X''' with X''?

Or do you want to average X'' with X, then X''' with X?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 14
(3,737 Views)

thank you so much for ur reply!!

I want to average:

X with X' to get X''

X with X'' to get X'''

X with X''' to get X''''

.. and so on.

this means, I want to take this output eachtime and feed it in one of the inputs.

 

0 Kudos
Message 3 of 14
(3,732 Views)
Solution
Accepted by topic author s.steen

Hi Sarah,

 

so you need to put the X''-arrays into a shift register, while the original X array stays constant:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 14
(3,727 Views)

Hello,

thank you again. I tried it similarily before, but it doesn't work correctly, because I want to set N iterations ´for example 3 iterations, to get the average values of the whole input arrays, not only the first 5 values.

for N = 3, I have to get for example:
X''''(0), X''"(1), X''''(2),...X''''(n), where n is the size of the input array

0 Kudos
Message 5 of 14
(3,711 Views)

Hello,

thank you again. I tried it similarily before, but it doesn't work correctly, because I want to set N iterations for example 3 iterations, to get the average values of the whole input arrays, not only the first 5 values.

for N = 3, I have to get for example:
X''''(0), X''"(1), X''''(2),...X''''(n), where n is the size of the input array

0 Kudos
Message 6 of 14
(3,707 Views)

Hi Sarah,

 

but it doesn't work correctly

What is "it" and where doesn't it work? What is the exact problem?

 

I want to set N iterations for example 3 iterations, to get the average values of the whole input arrays, not only the first 5 values.

My snippet generates averages for the whole array, so what's your problem?

Did you check the resulting 2D arrays?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 14
(3,702 Views)

1.jpg

0 Kudos
Message 8 of 14
(3,693 Views)

The resulting 2D Array is fine. I want to set N iterations for taking the output X'' as an input X' and perform this for the whole array. For N=1, an array of 2529 elements. 2 for loops?

0 Kudos
Message 9 of 14
(3,688 Views)

Hi Sarah,

 

there is a clear difference between my snippet and yours! Do you spot this?

 

Hint: check the inputs of the FOR loop!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 14
(3,685 Views)