Showing results for 
Search instead for 
Did you mean: 

Stream multiple waveforms

Go to solution



Based on the following example from NI:


I would like to stream multiple waveforms at the same time. I need to record simultaneously 5 of them. I added to the proposed VI from the link above an array with all the Waveform Paths I need. 


So, how can I write in a single TDMS file all the signals?


Thank you

0 Kudos
Message 1 of 10

Here is a White Paper that discusses some of the data logging methods available in VeriStand:

Viewing Time Correlated NI VeriStand Data Logs


Perhaps using one of the methods listed in this White Paper will help?


Highest Regards,

0 Kudos
Message 2 of 10



the thing is, I only want to modify an existing VI to incorporate that functionality. And it is written in the link I gave that it is possible: 

  • To stream multiple waveforms, create one stream specification for each waveform you want to stream.

So, I already created the different stream specifications but I don't know how to proceed with the Event Structure to record all the datas and how to access to those datas.

0 Kudos
Message 3 of 10

The event structure in the example you referenced will fire when any one of the waveforms is ready, so if you have multiple waveforms, you could have the event structure run more than once and build an array of all of the desired waveforms.  Once you have all 5 of your waveforms in an array, you could write them to a single TDMS file using the standard TDMS Write function.  

Highest Regards,

0 Kudos
Message 4 of 10

Okay, so when you write :

"you could have the event structure run more than once and build an array of all of the desired waveforms"


since all my signals are triggered at the same time, how can I run the event structure multiple times? Do I need to duplicate the Structure? Because I don't understand how I can build the array with all my 5 signals recorded.


Thank you for your time.

0 Kudos
Message 5 of 10

Hi Frank,


If you take a look at the example, you'll notice that the Event Structure is encased inside of a While Loop. Since the event structure fires each time a waveform is ready, each iteration of the While Loop will receive one waveform. From there, you can set up logic based off of the WaveformPath property of the WaveformStreamSpecification to write to specific channels inside of your TDMS file using TDMS Write.


However if you do choose to set up this architecture, make sure to only Stop the WaveformStreamSpecifications outside of the While Loop rather than inside the loop (which is what is shown in the example).


Although all your streams theoretically should fire at the same time, Event Structures have a queue built into the backend to allow you to catch all events in the order that they are received. Your loop will continue to run and process data as you receive it losslessly. 


I hope this clarifies the Waveform Streaming API a little bit. Let us know if you have any further questions!

0 Kudos
Message 6 of 10



Thanks for your help. I just need some clarifications on a few points:Capture.PNG


  1. Here, I am creating an array of Stream Specifications for all my channels and I use that array as input to the Register for Waveform Data Events VI and for the Start Streaming Waveform VI. So, should that work to collect the datas of all my channels?
  2. I am not exactly sure how I can access to the datas of all my Channels separately. The outputs I have coming out of the Event Case are a DBL waveform and a single Waveform Stream Specification. How can I switch from a channel to another?

Thank you very much



0 Kudos
Message 7 of 10

Right now, right after the event Structure, I read the data but it seems that I can only access the first waveform. So, I don't know if I am supposed to add a loop somewhere to collect the other waveforms..

0 Kudos
Message 8 of 10
Accepted by topic author frankr26

So, I finally found a way to do it. My issue was the End Condition of the While loop.Capture.PNG

Message 9 of 10

Hi Frank,


Thanks for posting an update, and glad to hear you were able to get it working! Writing to the appropriate channel in TDMS Write is the most essential portion, and it looks like you hit that on the dot here.


One quick note of feedback on this code - I noticed that you have a separate "channel name" array of strings control which you use to index through and select which waveform to pass in. Personally I'd recommend some sort of string parsing from your initial Waveform Paths array of strings to ensure that you don't have to input the channel name in two separate locations.


Hope this helps!



Yiran Li



0 Kudos
Message 10 of 10