LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

question about XY plot

I am using following method to plot a graph:
 
When the processing time is long, a large array will be generated for plotting xy-graph. What I am concerning is whether too large array will cause memory overflow problem. If so, any other alternative method to plot xy graph?
Thanks.
0 Kudos
Message 1 of 11
(6,765 Views)
I doubt that you'll see any memory overflow problems. You'll definately see CPU usage go through the roof, but I've never seen a memory overflow issue. Of course, if you're going to just let this routine run for days, I'm sure eventually there would be some kind of crash, since your computer can't have infinite memory.
0 Kudos
Message 2 of 11
(6,757 Views)

With this method you WILL crash eventually. It is never good to constantly build an infinite array inside a while loop. What you need to do is use initialize array on the outside of the loop for each array. By doing this you allocate all the memory you will need, next use replace array subset to put values into the array

 

 

 

Message Edited by Jhoskins on 02-01-2006 09:43 AM




Joe.
"NOTHING IS EVER EASY"
Message 3 of 11
(6,755 Views)
Trying the code you gave me, only the first element changes, other elements are zero. Can not get correct XY plot.
 
I am trying to plot a XY graph, with x-axis be passed time, and y-axis be an acquired value. I hope the origin of the the graph always be time=0 so that  the XY graph shows the whole history. I am using following code
 
SInce this method always need to collect all data to assemble the array to plot whole history, eventually my running will crash.  
 
So, how shall I overcome this problem? If I use replace array subset, I will not get the whole history, right?
 
Anyone can tell me how to modify above code? Thanks a lot.
 
0 Kudos
Message 4 of 11
(6,733 Views)
If it is impossible to plot whole history due to crash problem, maybe plot latest past 2000 points is also acceptible.
 
So, in this case, I initiate an array of dimension= 2000, then in every loop, I do 'first come first out', expeling out the first element, every other elements move to it's preceeding position, and add a new value to the last position. Is this the way to do?
 
Looks like this way is cumbersome, due to moveing every element to preceeding position. Is there an easy way to do this?
0 Kudos
Message 5 of 11
(6,724 Views)
Look in the shipping examples for a VI called XY Chart. It uses a subVI called XY Chart Buffer. What the subVI is maintain a history of a size that you can specify. This makes an XY graph behave like a chart.
Message 6 of 11
(6,708 Views)
The easiest way is to use a wheel which has been invented already. Smiley Wink

In your case the 'wheel' would be a VI which behaves like a Circular Buffer. Such a VI was e.g. published years ago by Gary Johnson in his (excellent) book      “LabVIEW POWER Programming”, Gary W. Johnson, Copyright 1998, McGraw-Hill, ISBN 0-07-913666-4" and I used it succesfully in some of my own VIs.
I hesitate to publish it here, though, since it's might be under copyright.

Maybe you can find copy of the book somewhere (or drop me an ICQ message with your email address)

-Franz


PS:
Just noticed Dennis Knutson's reply. That certainly should do the job, too.

Message Edited by fahlers on 02-01-2006 07:29 PM

0 Kudos
Message 7 of 11
(6,702 Views)
Erratum:
The book I wanted to refer to was 'Labview Graphical Programming', not 'Labview Power Programming'.

(For LV Graphical Programming see: http://www.amazon.com/gp/product/0071370013/002-0838780-6414454?v=glance&n=283155)
0 Kudos
Message 8 of 11
(6,685 Views)
How to get this XY Chart Buffer? I can not find this subvi in example foders. Also, I can open this subvi but can not save it.
 
The only way is copy it and paste to a new vi.
 
How does this vi reside in the system?
 
 
0 Kudos
Message 9 of 11
(6,676 Views)
Using xy_chart_buffer.vi is really a great idea. I used following code to realized my goal:
 
 
However, I still have another problem. How to clear the figure at the beginning of each run of this code? Just like sending an empty array to waveform graph. I tried and failed.
 
Without cleaning figure at beginning, the second run will start from the figure of the first run, and a line will occur between the last point of 1st run and the first point of the 2nd run, destroying the figure as following:
 
 
Thanks for your help!
0 Kudos
Message 10 of 11
(6,675 Views)