Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

12-12-2016 11:49 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

I am trying to update an XY Graph in each iteration of a "For Loop". The only way i can get it to somewhat work is if I place the graph outside my loops and tunnel the data thru. If i place the graph inside the inner loop, it will plot the first iteration, then clear graph, then plot 2nd iteration and so on. I want the graph to plot and update on every iteration ... any ideas ?

Solved! Go to Solution.

12-12-2016 11:59 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

The way that graphs work, they clear all previous data and update with the most recent array. You may be looking for a chart if youd like to update inside a for loop. The chart will accept an element data and update the existing data every iteration. Charts have an adjustable history length that can be used to change the displayed length of data and to also limit memory consumption when using a chart.

-Matt

12-12-2016 12:22 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

12-12-2016 12:29 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

If you data is a function of time, look at the Nugget by Crossrulz found here that talks about a waveform chart.

If you data is NOT time dependant...

Since there is no such thing as a XY chart, you would have to use shift registers to keep your history data from iteration to iteration and append the updates in the inner loop.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel

12-12-2016 01:05 PM - edited 12-12-2016 01:15 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

(sorry, posting by phone).

You simply need to substitute an explicit "build array" for the graphs and keep the array of plots in another set of shift register, eliminating the autoindex in you currently have.

Yes, since your x are spaced equally, all you need is a plain waveform graph. Also, since you know the final size of the data structure, initialize it before the loop filled with NaN (they don't graph) and substitute real data as it arrives.

12-12-2016 01:30 PM - edited 12-12-2016 01:31 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Assuming your x values are actually not equally spaced and the data structures are relatively small, here's a nearly literal upgrade of your code (If the data structures are large, go with the NaN preallocation and replacment with real data as mentioned).

Currently, it updates with each new point in the innermost loop. If you only want to update in the outer loop, place the indicator and "built array" there instead and keep the inner loop all orange.

I would also recommend complex 1D arrays for xy graph. Keeps the diagram simpler.

Download All

Virus scan in progress. Please wait to download attachments.

12-12-2016 02:44 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

I appreciate that AltenBach, thats closer to what I need. I guesss I should try and explain a bit more ...

I have some RF Test Equipment and am sweeping from 2GHz to 10GHz in 1GHz increments and recording the output power at set intervals. So my x-axis is my time "points" in intervals beginning at 0, and my y-axis is my output power levels at each frequency point. So my Frequency starts at 2GHz, waits the interval and then records a power, changes to 3Ghz , waits the interval and records, and so on ... Filling in the Data table goes from left to right, top to bottom , this is where i am having issues populating my Graph. I will get one datapoint on each frequency, then it cycles to start over @ 2 GHz ...

12-12-2016 02:55 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

OK, so I would initialize a final xy graph data structure (e.g. correctly sized 1D array of clusters, each containing a complex 1D array of the right size, all containing NaN). Place it inside a shift registers of the loop. Now you can replace with real data at any desired position at any time and fill them in any order.

12-12-2016 03:10 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

you lost me ... but i will see what i can do , appreciate it

Solution

Accepted by topic author gingram536

12-12-2016 03:29 PM - edited 12-12-2016 03:46 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

maybe like this?