09-23-2007 08:13 AM
09-23-2007 12:27 PM - edited 09-23-2007 12:27 PM
You need to "think dataflow"! 🙂
Your graph clears just fine, bu one nanosecond later, you read the same old data from the input tunnel and send it again to the graph.
Here's one possible way to do it.:
Unlike charts, graphs have no history data and will just graph whatever is in the array coming in. There is no need to clear, just send a new array and it will replace the old data.
Message Edited by altenbach on 09-23-2007 10:27 AM
09-23-2007 12:31 PM
A graph retains its data until new data arrives, so there is no need to constantly update with the same old data. You should simply make sure that your loop only spinf if new data is available, there is no good reason to spin a loop if all it does is reprocess the same old data.
@0401061296 wrote:
Just one more question, is there anything in labview which waits for certain period of time for data coming in (like time out), if no data has come in during that period of time, it display the previous data on graph.
09-24-2007 10:58 PM
Thanks for your vi file and it is really helpful.
I have noticed that your file only works fine when the size of incoming 1-D array is constant and an even number. However, when the size of incoming array is variable, the remainder from the remainder-quotient function is non-zero therefore there will be some loss of data that is displayed on the graph.
For example, when we set the N =95 (the size of array) and 10 elements of the array should be sent to the graph, this will result a remainder of 5 and the waveform graph will only display the first 90 bytes data, and miss out the rest 5 bytes data..
For our application, the size of array changes all the time and new data keeps coming in. If we update the starting index value periodically and dont delete the previous data which has been displayed on the graph, it will eventually overflow the buffer.
Is there anything we can do to destroy or remove the part of the array elements which have been displayed on the graph previously, and shift the rest of the array elements down so that the total size of the array will be kept relatively small and does not overflow the buffer?
Thanks in Advance.
Kim
09-24-2007 11:47 PM
Everything is easily possible, you just need to know what you want. 🙂 My example was very simple and shows that an graph does not retain history data. If it receives variable amounts of data, the graph will show variable amounts.
You can for example use a chart display. You can set the history lenght to the number of points you want to display in the chart. Incoming arrays will be appended to the existing graph and older data (exceeding the history lenght) will drop out. In your case you can right-click and set the history lenght to 102. You can also change the update mode as needed. (top code on example).
If you want to use a graph instead of a chart, you can keep a buffer in a shift register where you would move data in as desired (using replace array subset) and keep track of the insert point. Initialize a shift register with a fixed size array. Rotate the existing array left by the size of the new data array, then replace the tail with it. Send the result to a graph.
For simplicity, you could even use the "collector" epress VI. (bottom code on example).
09-24-2007 11:58 PM
@altenbach wrote:
If you want to use a graph instead of a chart, you can keep a buffer in a shift register where you would move data in as desired (using replace array subset) and keep track of the insert point. Initialize a shift register with a fixed size array. Rotate the existing array left by the size of the new data array, then replace the tail with it. Send the result to a graph.
09-25-2007 05:32 AM
09-25-2007 05:32 AM
09-25-2007 06:38 AM