LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Build array or merge signals?

Solved!
Go to solution

I know there are more than one way to merge waveform signals to display them in a waveform chart. The two I know are merge signal express vi and build array. But I was wondering which one of the two were more efficient. I once read somewhere in this discussion forum that "build array" is one of the more time consuming tasks.

 

Not very critical to what I am doing (a loop of data acquition takes just a few milli seconds with build array) but was just wondering if one or the other was a better way to do it. Or there might both be the same.

 

Thanks.

0 Kudos
Message 1 of 6
(5,481 Views)

Whenever the size of a data structure changes, a new memory allocation needs to be made. It does not really depends on what primitive you use.

 

Do the sizes actually change with each iteration or does the final size remain constant and you are just merging inputs of constant size?

Message 2 of 6
(5,469 Views)

I am reading data from the data acquisition using 1 Sample (On Demand) mode.

 

1. So at each loop I am acquiring one data. I wire that into build array and the build array is wired into Y component of Build waveform.This is how I build my waveforms.

 

2. I build two waveforms separately and these waveforms are wired into another build array to display both the waveforms in the same waveform chart.

 

All this only to display the data in the chart so that the starting point in the waveform chart is 0 sec in relative time, and I can initialize t0 of the waveform to 0 sec when I want (this is the only way I know how to do it). Otherwise I use the individual data points for PID control and other calculations. 

0 Kudos
Message 3 of 6
(5,458 Views)

Using a build array for a chart when you are acquiring a single point just because you do not know how to properly initialize the chart seems, rate, uh strange. No need at all to get this complicated. Look at the example called Real Time chart to see how to set the x axis to match your loop iteration rate and look at the example called How to Clear Charts & Graphs. Just do a search for 'charts' in the example finder.

Message 4 of 6
(5,446 Views)

I checked those out. I have my data acquition inside an event structure which is timedout to 200 ms. So I am not exactly sure about the loop iteration rate. It is 200 + few milli seconds. In that case I wouldn't be able to specify an exactly value for the Xscale.Multiplier. I know this is not the right way to do and I should have used two parallel loops, one for the data acquisition and the other for the user interface but I came to know of these things just last week. These are for future improvements. But right now I need to get my system up and running so for the moment I will stick to what I have. Once I have tested my logic and got my experiments going I will get back to using parallel loops.

 

Will using all these build array as I have done cause any problems?

0 Kudos
Message 5 of 6
(5,429 Views)
Solution
Accepted by topic author sharmaa

If I'm understanding correctly, you're only building one piece of data into a 1x1 array each time through the loop.  If that's the case then there's no problem with the way you're using build array and build waveform to get your data on the graph with the right timestamps.  It's perhaps not the most efficient approach but at a 200ms update rate you're unlikely to have problems.

 

Build array causes problems when you're constantly adding to an existing array, because the array keeps growing and needs to be reallocated each time a new element is added.

Message 6 of 6
(5,413 Views)