LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to clear graph

Hi,

 

its wha again...

Found an old   "Test sweep - vi"    now updated    ...  was a Demo for one of my Colleagues

 

I have saved it as LabVIEW2008 - version and it works without any Hardware attached.

Try it out

Rgds

wha

0 Kudos
Message 11 of 18
(1,011 Views)

@jason91 wrote:

 

I have tried on the solution you shared. But the graph from previous iteration will appear when I run for second looping. Do you mind to share with me how to clear the data logging in the graph when running the next loop? As I tried on your solution, whenever Clear button is pressed, the graph will be cleared. However, the graph will be reappear when the Clear button is pressed again. From this, I think the data still store in the indicator. I'm looking forward to receive your advice.


OK, I looked at your code and don't quite see how it relates to your problem description. The inner loop records several traces and "clear" is only true when the outer loop is at iteration zero. During that time, the data is also stored in the two orange shift registers.

 

The program seems to work as I would expect, so if you expect a different behavior please provide a step-by-step description exactly how you are using it. What are the various settings? (all at default?) What happens and what do you expect to happen instead.

 

(Overall, the code seem overly complicated. Why is "Y" sometimes EXT precision (makes no sense!). It would seem much easier to use complex data type for the xy data. Why is the inner loop not a FOR loop (with a conditional terminal)? If you would place the "stop" terminal inside the inner loop, you would not need any local variables for it and it could be made latch action. The "[i]+1>=14?" belongs in the outer loop because the result is always the same., etc.)

0 Kudos
Message 12 of 18
(1,003 Views)

Hi Jens,

 

Yes, I have attached it below. I have figured the problem by setting the reset in the build XY graph. Thanks for the respond.

 

Regards,

Jason

0 Kudos
Message 13 of 18
(989 Views)

Hi Knight of NI,

 

I agreed that there is an error in the coding. I should set a TRUE constant outside the While loop to reset the build XY graph for every new run. 

I'm using a graph to display the result. From the solution provided, it does not really clear the data, in fact it will be loop into the TURE condition (empty array) when the button is pressed. But once the button is pressed again, it will entered to the FALSE condition where it will display the previous result. I have uploaded my case study. Kindly correct me if I'm wrong. Or if there is any features we could use for the building the graph, please share with me as well. I'm still in the learning phase. 😃

 

Thank you for the sharing anyway.

 

Regards,

Jason

0 Kudos
Message 14 of 18
(988 Views)

Hi Wha,

 

Thank you very much for sharing your example. I have found the problem in coding. You may refer the attachment below. Hope you don't mind to share more with if any error found.

 

Regards,

Jason

0 Kudos
Message 15 of 18
(985 Views)

Your program still does not make a lot of sense.

 

  • There is no reason for the lowest shift register. Just use [i] for the comparison
  • The number of iterations of the inner loop is known before the loop starts, thus you need a FOR loop.
  • You can reset the "build xy graph" express VI on [i]=0. No need for the green shift register.
  • you should remove breakpoints before distributing code.
  • There is no need to spin the inner loop 1000x if step0
  • Your 1000 diagram constant should be blue.
  • Done right, all you need is the outer loop and a single case structure for a state machine. Try to simplify. One state would be to ask for "what now?".
  • I don't see any reason to write empty data to the graph via a property node. It will reset a few nanoseconds later anyway.
  • your state enum should be a typedef.
  • ...
0 Kudos
Message 16 of 18
(978 Views)

Here's exactly the same functionality with somewhat cleaner code (one loop, one case structure, etc.). It would be simple to add more states as needed.

0 Kudos
Message 17 of 18
(969 Views)

Hi Altenbach,

 

Thank you very much for putting effort to readout my coding. Ya, those mistake you pointed out is a very good finding. Actually the vi I uploaded is an simulation of my problem with similar configuration. So some features might seems to be less useful. However, I do agreed with you that by reset the graph is able to refresh the data while the constant to property nodes seems to be a redundant in this case.

Once again thank you for your advice in solving my problem.

 

Regards,
Jason 

0 Kudos
Message 18 of 18
(952 Views)