From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
07-29-2015 12:48 AM - edited 07-29-2015 01:02 AM
Hello
I'm working on project data is loged and displyed on XY graph.
I just want to place a button when ever user want Clear The Graph and also need to clear During Cod Running (for example for initial or end of Test).
I saw here people sugest using "build express XY " and simply use Reset Input.
but i have to reset in deferent place in code and as far as i know it's imposible .
here is my XY Graph:
and because of using shift register i can't move constant array to bufer array .
Best Regards
07-29-2015 01:07 AM - edited 07-29-2015 01:08 AM
Hello,
All depends on the framework, there are many possibilities. You can also clear the Graph by the menu you get via right mouse click. You can wire a cluster with empty arrays to the XYGraph, it will delete it also. For this you can use a CASE structure. You can also clear the Graph in similar way via property node value or local variable, but the wire is the recommended and usually possible approach.
You have another problem with the example you show: there is indefinitely growing arrays stored in shift registers, after a while this will flood your RAM and crash the application.
Why you connect a Boolean False to the stop condition in the while loop? Never use the red Abort button to stop your VI! Connect a Boolean control.
I would really recommend you to go through some learning material:
Learn NI Training Resource Videos
6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training
07-29-2015 01:36 AM - edited 07-29-2015 01:39 AM
hello Blokk
" You can wire a cluster with empty arrays to the XYGraph, it will delete it also."
Yes but after start again it will be displayed again! becasue The array that feed graph didn't change.
"there is indefinitely growing arrays stored in shift registers, after a while this will flood your RAM and crash the application."
what is your suggestion ?
"Why you connect a Boolean False to the stop condition in the while loop? Never use the red Abort button to stop your VI! Connect a Boolean control."
you are right this not my original code here i just examine how to clear and so on .
07-29-2015 01:44 AM - edited 07-29-2015 01:45 AM
@mori64 wrote:
hello Blokk
" You can wire a cluster with empty arrays to the XYGraph, it will delete it also."
Yes but afer start again it will be displayed again! becasue The array that feed graph didn't change.
Use a CASE structure as I said.
"there is indefinitely growing arrays stored in shift registers, after a while this will flood your RAM and crash the application."
what is your suggestion ?
Usually I program a Functional Global Variable which acts as a buffer for data. Inside the FGV I limit the size of the stored data, when the buffer is full, I continuously delete the old data points and add the new data points. There are other options to create such functionality, even built-in ones (for example the "Data Queue PtByPt.vi").
In this way you do not create a memory leak. You could also consider using Chart instead of a Graph, but it depends on your requirements... A Chart has a limited history, by default only stores 1024 points.
As I wrote before, part of these things are totally basic, if you start to learn and go through the teaching material, it will help you a lot! 🙂 I recommend you the Core 1-2 online course!
07-29-2015 02:32 AM - edited 07-29-2015 02:34 AM
07-29-2015 03:21 AM - edited 07-29-2015 03:22 AM
Hello altenbach
"The data is not stored in the "cluster", it is stored in the shift registers. In order to clear the graph, simply feed an empty array to the shift registers"
You are right.
"
I got the point .
" What is the point of "Array 3" and "Array 4" controls? do they even have any interesting data?"
I thought by this way i can feed the arry inside of while loop .
"If you would use a complex 1D array for your graph data, you would only need one shift register, simplifying the code and data structures."
as i know i need 2D array for XY Graph
here is my try
07-29-2015 08:30 AM - edited 07-29-2015 08:35 AM
mori64 wrote:" What is the point of "Array 3" and "Array 4" controls? do they even have any interesting data?"
I thought by this way i can feed the arry inside of while loop .
No, they are outside the loop and are only read once at the start of the program. there is no point having those or writing to them once the loop has started. Why would you need to feed them? Are they hungry?
mori64 wrote:as i know i need 2D array for XY Graph
Your code does not have any 2D arrays, so what are you trying to say? Obviously you are wrong!
In your code, the X-values are spaced evenly in time, so a plain waveform graph would suffice. Why do you even use an xy graph?
It is possible that all you need is a chart. No reset needed because the history size is fixed.
Learn the difference between xy-graphs, plain graphs and charts and how to use them.
Looking at your code, I really recommend that you start with a few simple tutorials, because it is obvious that you lack basic understanding of dataflow. What's the point of the inner while loop? Since it never iterates more than once you can delete it and nothing would change, What is the purpose of the event structure? Since you are polling anyway, an event structure has no purpose. What is the point of the case structure? All you do is spend a nanosecond doing nothing in case zero then go to case 1 forever. (Since you are incrementing by one in all cases, you would get the same value by just tapping into the iteration terminal if you would really need all that, but you don't!).
Let's assume that your x-values are actually not spaced evenly and you actually need an xy graph, here's how your old code would look like. Arguably simpler! There is typically no need for hidden controls/indicators and local variables. the data is in the wire!
Now try to rewrite it using a plain graph or even a chart. It would be much simpler!
07-29-2015 09:23 AM
07-29-2015 09:29 AM
If your graph is going to use a constant distance between points, you can call the X axis whatever you'd like. If you want to have different spacing between points, you'll need to remain with the XY Graph.
07-29-2015 09:56 AM - edited 07-29-2015 10:17 AM
@mori64 wrote:
Thanks for your replay I need to display Force as X and distance as Y . is it possible using Graph ?
Only if your points (force) are spaced equally in X as in the example. I already said that.