04-24-2018 07:17 PM
Hello everyone, the attached code is an example I'm using FGV to store data in an array. The timed loop is running at 1Hz and pass the data to the FGV which initialize with an empty array, the new data will be appended to the end, one row per second. I would like to plot each column data every 24 hours. For the next 24 hours, it updates with a new plot. Can anyone teach me how to do this? Thank you very much.
04-24-2018 09:31 PM
Hi Xiao,
It looks like your code already does most of what you want. Can you go into a little more detail as to what you mean by "plot"? As in, do you mean that for each column of the array, you wish one line in a 2D graph? If so, use a Waveform Graph and then right click on it and choose "Transpose Array", then connect it to the Read output.
A couple of other notes:
04-25-2018 09:31 AM
I did what you said choose transpose array and connect to the output array, it works like waveform chart updating the line at 1Hz for this example, which is fine, but how to make the x-scale sync with current time, I tried to use build waveform function, failed.
04-25-2018 10:41 AM
If you want to use real timestamps, take a look at the XY-Graph. This takes a variety of inputs - take a look at the Detailed Help via the Context Help window, or right click on the graph and choose help.
This is more complicated than the Waveform Chart or Graph, but it can be more useful if you have both X and Y points!
04-25-2018 11:24 AM
@cbutcher wrote:
If you want to use real timestamps, take a look at the XY-Graph. This takes a variety of inputs - take a look at the Detailed Help via the Context Help window, or right click on the graph and choose help.
This is more complicated than the Waveform Chart or Graph, but it can be more useful if you have both X and Y points!
Easier solution: Sporadic Waveform Chart
04-25-2018 04:17 PM
The attached code is a demo, the first column is time, and each column represents one sensor. I use FGV to save the data append to the array. How can I make waveform graph with my time stamp which is the first column value as X-axis?
04-26-2018 12:30 PM
I am not seeing the point of your Array Global. You actually just created a race condition with it. Why not just make a shift register on your consumer loop and use Build Array on that? Also, do you want your array to grow indefinitely or do you only care about the latest X samples?
Other notes:
Learn to use Initialize Array as that will simplify your upper loop some.
Your Build Array should accept all of the 1D arrays and then you can transpose if needed after that. A lot simpler than having 5 sets of Build Array with 1 input and then Transpose Array for each of those.