LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"clear data from an array"

I am taking the data in a while loop and wanted a continuous graph. So I put graph in the loop and use shift registers to keep the old data and plot them also.
now I want to know how can I remove my data from that shift register thing because after some time I want a clean graaph but it keeps those old data and plot everything.

Can anyone hwlp me to know how to get rid of old data from the shift registers!!!
0 Kudos
Message 1 of 4
(3,117 Views)
Put a case structure in the loop, operated by a latched boolean control named "clear graph" or similar.

False case: Just wire the array across.
True case: wire an empty array to the output tunnel.

Now, whenever you press the button, the true case becomes active and the shift register receives an empty array.
0 Kudos
Message 2 of 4
(3,117 Views)
thanks a lot....
0 Kudos
Message 3 of 4
(3,117 Views)
Overall, that should get you going if the application is not too demanding. In general, it is considered bad form to grow and shrink arrays in a loop, especially as in your case where it would grow forever without user intervention. This can lead to performance issues.

Some suggestions:
(1) Use a chart insted of a graph and set the history length to an appropriate value.

(2) Initialize with a fixed size array, e.g. filled with zeroes or "NaN" as appropriate. Then use "replace array subset" to add new data, replacing the old while keeping track of the insertion point. Since the array size is constant, performance will be much better.
0 Kudos
Message 4 of 4
(3,117 Views)