11-19-2008 11:22 AM
I am using a feedback node to build an array.
When I stop the VI and run it once again, the values in the feedback node from previous iteration are introduced in the array.
How do stop this from happening ? Is there command /VI which could be used to remove the values in the feedback node?
11-19-2008 11:37 AM - edited 11-19-2008 11:37 AM
Initialize it:
Andrey.
11-19-2008 11:37 AM - edited 11-19-2008 11:38 AM
Have you wired a value to the initialization node of the feedback node? (looks like a small diamond).
Which version of LabView are you using?
Hope this helps.
Beat me to it.
11-19-2008 11:38 AM
Wire an empty array constant to the initializer terminal. Better to initialize the array size and use replace array subset instead of building an array, especially if you anticipate this array to become large.
11-20-2008 02:44 AM
I am using Labview 8.2 .
I am attaching a picture here showing the code. I will be useful , if you could have a look at it.
Basically, I am using a case statement to record position values when ever case is triggered true.
At this point, I am trying to get the feedback node to initialize only once when the VI starts. If the VI is stopped and started in between, the feedback node should again be initialized to zero and not use the values from previous iteration. This is the problem.
Also, it would be useful to have information about "reintializing all values to default" every time the VI runs within the Block diagram of VI.
11-20-2008 08:52 AM - edited 11-20-2008 08:54 AM
Right-click on the diamond looking box on the left side of your for loop, and select Create --> Constant. This will create an empty array constant. If the code you posted sits inside another loop (e.g. a while loop), then right-click on the initializer terminal again and select Move Initializer One Loop Out to get to your outermost loop. This will initialize the feedback node only when you start the program.
To reinitialize all values to default, you can do something like this:
Edit: Re-posted code as VI
11-20-2008 10:55 AM
Thank you for the re-initializing code Sima.
I made some code to initialize the feedback pointer to zero whenever the VI runs.
It is in the attached pic.
11-20-2008 10:58 AM - edited 11-20-2008 11:00 AM
Shan21 wrote:
.
You can delete the shift register, it serves absolutely no purpose here.
(also, as noted in the other thread, your FOR loop is pretty uselss. Use the outer loop for accumulation.)