LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to concatenate arrays of waveforms?

Hi Cleat,

Matt F's example demonstrates one method that will work.

Another approach would use the chart object as Debonair suggested.

In that case, you hcan use the chart property >>> History data to get all of the data plotted on the screen.

CPU-wise this approach will more efficient becuase the chart does your buffering for you. But then again you do not get something for nothing! When it comes time to pull the history data and start proceesing it, you will then be able to use the code Matt F provided to put all of the "updates" that will be returned by the History data to put thing into a 1-d array of waveform data types where each element of the array has the complete set of reading for a channel.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 11 of 15
(2,702 Views)
HI cleat,

you would be better off listening to BEN his one the best there is in the business, I only suggested the way that I did because you said previously that they did not work the way that you wanted. the way that I gave you is really intense on the cpu. If those ways will work for you then use them.



Joe.
"NOTHING IS EVER EASY"
Message 12 of 15
(2,697 Views)
Hi Joe,

You flatter me!

I just had the luxuary of sitting back and watching others guess at what needed done.

I am still not sure we have solved this Q

Only Cleat can answer that Q.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 13 of 15
(2,693 Views)
Guys,

Thanks for the responses. I tried splitting the array into single waveforms and using the Append Waveforms.vi, but this created a huge delay in between the acquisition of sample sets. Ben: which History property are you referring to? Just extending the Chart History length? Anyhow, I changed the waveform plot to a chart, yet it still only gave me the amount of points associated with one sample set when I tried to read from it. Regardless, I think I found a more efficient method: use Cont Acq&Graph Voltage-To File (Binary). I thinking this will be my best bet if I want to minimize delay. The only problem is that I'm having trouble reading from the binary file using Read Binary File.vi. I connected a local variable referenced to my Measurment to the Byte Stream Type connector on Read File.vi (a subroutine in Read Binary File.vi), but I get Error 116:

Possible reason(s):

LabVIEW: Unflatten or byte stream read operation failed due to corrupt, unexpected, or truncated data.

I'm getting really annoyed. Can anybody help? Please!?
0 Kudos
Message 14 of 15
(2,681 Views)
Hi Cleat,

You can help us help you by posting code that we can look at and modify.

The waveform chart is really pretty efficient when it comes to CPU demands. It is smart enough to know when the data needs rescaled and provided it do not need re-scaling, it can simply shift a line a pixels and and a new set for the new data.

Provided you are not re-scaling, it is hard to beat the chart.

If you right click on a chart and select "create property node" you can then configure it as read and to return the history data.

Attached is a zip of some LV 7.1 code that includes a jpg of the block diagram (in the event you do not have LV 7.1).

It the example (which is a mod of Matt's code) I,

1) Clear the chart by writting an empty array of waveforms
2) Use a while loop to update the chart once a second
3) When the data collection is stopped, the history is read from the chart and displayed to illustrate that there is more than one update in the chart.
4) Transpose the history data (becuase it simplifies the rest of the code).
5) Index off the first row of the transposed array (this is all of the update for one channel) and pass it to a "delete from array"
6) The delete from array is used to init a shift register with the first update for that channel.
7) The remaining array returned from the "delete from array" is passed to a tunnel with auto-indexing enabled. This controls the number of time the inner for loop iterates and lets me walk through each of the updates for the channel.
😎 These updates are slapped on the back side of the previous waveform (for this channel) and the new "enlarged" waveform is saved in a the same shift regisiter we inititalized when we started this channel.
9) After all of the updates for a channel have been hooked together they pile up in an output tunnel.
10) The results are displayed in a Graph that you have already figured out to work with.

I hope this helps,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 15 of 15
(2,670 Views)