the chart gets new data with each iteration of the while loop.
But it doesn't make (absolutely NO) sense to clear the chart history in each iteration!
Did you read the caveats on the event structure? (I guess no: please do so…)
Hi thanks for a quick response!
If i don't include clearing the chart in each iteration, it does display the signal while the code is running but I then have no control over when it stops running.
If i don't include clearing the chart in each iteration, it does display the signal while the code is running
So that was your problem - it is solved now.
but I then have no control over when it stops running.
That doesn't make any sense: moving that property node out of the loop will not change the behaviour of the event case or while loop!
This is what's confusing me! Without the clearing inside the loop, the chart runs up to the thousands very quickly, when I only need it to run for t=100.
I have made a lot of codes like this but have never had this problem before.
Without the clearing inside the loop, the chart runs up to the thousands very quickly, when I only need it to run for t=100.
Because you programmed it this way!
You create your own buffer array in the shift - and then send the whole buffer to the chart:
In the first iteration the buffer contains 1 row of data, the chart shows one row of data.
In the 2nd iteration the buffer contains 2 rows of data, the chart shows 1+2=3 rows of data.
After 10 iterations the chart already shows 55 rows…
As said before: everything works exactly as you programmed it!
use one of the two options suggested before…
You need to read up on the differences between a graph and a chart. GerdW already gave you the solution.
- Use a graph instead of a chart.
- Wire the new data directly to the chart.
Sorry didn't notice that part of the message!
I've tried using a graph already and it doesn't work with the code. I've just wired the data straight to the chart but that also doesn't work.
I appreciate all the help but it won't work.