08-13-2013 04:34 AM
Good day,
I have some problems with the simulation loop. I want to collect my simulation data but without the express-vi "Collector". Therefore I used an array with feedback node. But if I start my simulation the array gets bigger and bigger (the new data is stored in the array but the old data exist there too).
So, is it possible to reset that array? The "initialize feedback node" does not work : /
08-13-2013 07:45 AM
Keep in mind that wiring the Initialize terminal only affects the feedback node the first time it is called.
Sounds like you want to conditionally change the stored value. This can be as simple as wiring a boolean control to a Select function, where you select between the array you have been building or an empty array. The result is wired to the input of the Feedback Node.
08-13-2013 02:34 PM
Hi,
I suggest you to use fixed sized array for buffering your data. It is a kind of performance enhancement technique. You mentioned "reset" for your buffer. I practice we do not reset or clear the entire array only "update" a specific item in it, mostly the oldest item in the array is updated at first.
Please google for "ring buffer", that may help.
Good luck!
08-14-2013 05:27 AM
Hey,
garretmarsh's solution worked for me.
Thanks to both of you.
08-14-2013 08:21 AM
Glad to hear it Thion. I will say that D60 has a very good point - constantly resizing the array, like you are doing, is very bad for memory usage and efficiency. It may be sufficient for this task, but in general, it is best practice to use some kind of fixed-size buffer instead.