Good day programmers,
I have a discrete subVI that I would like to implement in a For Loop. The SubVI depends on values from previous loop iteration (While loop iteration), i.e. there is feedback node/shift register inside so if you just implement subVI in the For Loop as is, the previous value in the SubVI is going to contain value from the previous For Loop iteration value not the actual value from the previous While Loop operation. How do we go around this?
As a simple example, let me use the discrete pt-by-pt moving average VI. I have attached a For Loop Test.vi in which I have an array of 4 values that are offset with random values on top of for noise injection. Then I have independent 4 pt-by-pt moving average block running in parallel and one pt-by-pt moving average block in the For Loop. You can see that each For Loop iteration value affects the previous value in the moving average block.
It would be really nice to be able to implement such SubVI as the ptbypt moving average for a variable size array. That way you don’t have to index the array and do it individually element by element. Seem like it should be simple but I can’t figure it out.
I hope my explanation of the problem is clear enough. I appreciate any advice.
I'm not on a LV machine to look at your code, but it sounds like this *might* be a case where the subvi should be reentrant (with pre-allocated clones). Then each instance of the subvi that you drop on the diagram has its own distinct feedback node. The one you place in While Loop "A" is completely distinct from the one you place in For Loop "B".
I'm not sure I understand your question, are you wanting to use Mean Pt by Pt on several different pieces of data, which you don't know the number of until later?
I do not know a way to do this, but I have put Mean Pt by Pt in a case structure (one instance in each case) which is just selected by the iteration terminal of the loop. This makes it a little more compact on your diagram.
Thank you for your reply.
Yes I would like to use the Mean ptbypt on several pieces of data. We know the number of data for a given application but it may be different for a other application.
I am not sure I follow your suggested implementation.