LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Color XY plotter

Solved!
Go to solution

Can someone take a look at the vi's below and see if it can be sped up.  It is functional but it takes FOREVER! 

 

The "Color XY graph 2.vi" is the main app.  It takes 2 analog waveform files and plots them on an XY graph.  The color of the plot is selected by the "z" digital waveform file.  Please help me change this vi so it works a little faster.  I'm also open to suggestions for other ways of accomplishing this. 

 

The purpose of this vi is to simulate video displayed by a pattern generator. 

 

Thanks,

0 Kudos
Message 1 of 4
(2,734 Views)

You did not include the VIs to read the data. Are these from a toolkit? What is the structure of the files?

Could you create a VI that contains the xyz data arrays as diagram constants, thus avoiding the missing VIs?

 

In any case, You have complicated data structures (clusters of arrays) and you are resizing the innermost structures with every iteration of the loop. This causes extreme memory trashing with a severa impact on performace as you noticed.

In any case, create the data structures more efficiently, and you should be much better off. You know the final size from the beginning, so allocate the final size then replace with real data, for example. You are also creating way too much data.

 

You could use an intensity graph with 16 levels and assingled colors. For some ideas have a look at this old VI (from here). Your problem is simpler, because you have 16 fixed levels.

 

 

0 Kudos
Message 2 of 4
(2,724 Views)
Solution
Accepted by topic author jallen_100

OK, I was able to extract the default data contained in your xy graph and put it in controls. Your code is glacial!!! Takes forever.

 

Here's a quick attempt at a speedup. Seems to complete in the blink of an eye. 😄

 

 

We don't need the progress bar, but if you want, you can put it back.

 

It is still quite inefficient because of the building of arrays in loops, so it probably could be sped up by a few more orders of magnitude, depending on the data sizes. (You would first create a histogram of the values in the z array to determine the final sizes of each of the 16 colors, then initialize the shift registers with the correct size in the outer loop and use "replace array subset" in the case structure instead. See how far you get.) 

 

Download All
Message 3 of 4
(2,718 Views)

Thank you!!  I messed with this for hours but could not see the solution.  The code started as simple as yours before it grew into what i posted.  I knew i was missing something stupid.  Thanks again. 

0 Kudos
Message 4 of 4
(2,705 Views)