LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

plottng two elements of 3D array in 2D

Hello.
 
I have an xy plot (2D) at occurs at time t.  I need to plot this x,y at time t against a previous set time, say (t-1000ms) .
So I beleive the data should be stored in a 3D array as sequence data, so this would be Plot(x, y, time/sequence)
Im not sure how to get started with this.
 
The amount of sequences (3rd dimension) would have to be limited to about 1000 to not bog down memory.
I have built a 3D array using "build array" 3 times but im still just confused how to go about this.
Can someone point me to an example or provide advice.
 
0 Kudos
Message 1 of 3
(2,663 Views)
You should note that arrays need to have the same number of elements in all "elements" of a certain dimension. This means that each repetition will need to have the same number of rows. If it doesn't, you will lose data or need padding.
 
Here's one example of how to do this, which assume you know the number of repetitions and data points in advance. I believe it should require a single ~50 MB memory block.
 

___________________
Try to take over the world!
0 Kudos
Message 2 of 3
(2,638 Views)


vonsin wrote:
I have an xy plot (2D) at occurs at time t.  I need to plot this x,y at time t against a previous set time, say (t-1000ms) .
 
The amount of sequences (3rd dimension) would have to be limited to about 1000 to not bog down memory.

You don't give enough information, for example you don't say at what rate the data arrives. For example if new data arrives every 1000ms, then you would need to just keep one set in memory and subtract current-previous. Peanuts! Since you are talking about keeping a history size of 1000, it seems you maybe want to subtract the data from 1000 histories back. Please clarify!

Let's not forget that xy graphs can take an 1D array of complex data. (It will plot IM vs. RE), so all you need is a fixed size 2D array of complex datatype to keep your history.

Keep the history in a shift register and for each iteration:

  1. read the oldest data.
  2. subtract the oldest data from the new data and plot it.
  3. overwrite the oldest data with the new data in the history array.

Here is an image of a quick draft that would do that. Let me know if anything is not clear. (the two array operations in the loop are "index array" and "replace array subset"). Most likely you need to adjust a few things for your exact requirements.

You should also decide what should get plotted during the iterations where there is no history data yet. If you initialize the array with 0+0i, it would just plot the raw data. If you would initialize with NaN+NaNi, it would not plot anything until there is valid history data to be subtracted.



Message Edited by altenbach on 12-15-2007 11:35 AM
0 Kudos
Message 3 of 3
(2,628 Views)