Jump to content

Two while loops updating one waveform chart


Recommended Posts

Let's say I have two different while loops that I need to run. I want the numbers generated in while loop #1 to be shown on a waveform chart that updates during the loop. Then, when that loop is terminated, the code continues on via a flat sequence to another while loop, #2. I want to display the data from while loop #2 in the same waveform chart as while loop #1. Is this possible?

My difficulty is I have 6 while loop sequences which need to execute sequentially. I only want to view the data in one waveform graph or chart that updates during each itteration of each sequentially executed while loop. Otherwise I have to have 6 waveform graphs to view the results for each while loops. I don't need to see the data in parallel since the operation is sequential anyway.

Is this even possible since a chart doesn't seem to update unless it's inside a while loop?

Link to comment

Sounds like the really easy and fast answer is to just place a Local Variable of the chart indicator in the subsequent while loops. I believe you need to manually flush the History Buffer of the chart to clear the old data before plotting the new.

David

Link to comment

I totally concur with Paul's suggestion. One of the many benefits of using queues is that you can use a cluster with an enum and numeric inside of it as your data type for the queue. Then when you dequeue an element from it the enum would tell the loop that is operating on the chart what to do (clear the chart,add to chart, even change attributes of the chart if you want). Oh, and of course you can stop your chart loop with this mechanism as well when your main sequences are finished.

Here's a very simplified example w/o error handling or deferred panel updates optimization:

Download File:post-3266-1207858000.vi (LV8.2)

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.