LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using waveform element to build arrays

Hello, there,

from this forum, I learned that i can use "get waveform components" to extra time and data from waveforms.  great.  but how do i build an array and output it to a file?  does it come as a strand of arrays as it is?  or do i need to loop it so the index will shift?

if you can help and have an example...you'd be awesome!

best,

ck
0 Kudos
Message 1 of 4
(3,557 Views)

You can save waveforms to a file with the Export Waveforms to Spreadsheet File without doing any conversion. This will create a text file. You can create a binary file with Write Waveforms to File. Both functions work with a single waveform or a waveform array. If you want to extract just the Y array, you can do that and then use Write to Spreadsheet File. If you have a waveform array, you can put the Get Waveform Component inside a for loop and create a 2D array that Write to Spreadsheet can also use.

Message Edited by Dennis Knutson on 04-15-2006 05:02 PM

Message 2 of 4
(3,544 Views)
Dennis to the rescue as always.  I was about to throw my computer out the window. 

Thank you Sir and congrats about your 7000 posts.  Quite the feat you have accomplished.  And really...it's not so much about the number of posts but the number of people you have helped and the difference you have made.  So, thank you for making our life easier.

I am actually trying to get the rms(via amplitude and level measurements function) value into an array.  i am able to do that by using the append array function and do it recursively.

however, here is a list of complications i encountered,

1.  i couldn't get the time stamp of the rms value.  the amplitude and level measurements function return a single number as oppose to an array of time stamp
2.  i am not sure if the data array i created represent the actual data....whether it is being appended randomly or deterministically.
3.  i think the way i have the data entered into the file is drastically slowing down the computer.  (it would actually take the computer 2 seconds to disply a 1-sec update.)  😃

Dennis, I'd love to implement your suggestions.  Please help.

Best,

CK
0 Kudos
Message 3 of 4
(3,525 Views)

If you want to create an array of timestamps, one way to do it is like in the picture attached. Using Export Waveforms To Spreadsheet File will do this for you too, if I remember correctly. I don't use the function that much.

You data is not appended randomly but whether it is correct or not, I can't say without having the actual VI to run and knowing exactly what you are trying to do.

The function Write Characters to File is probably slowing things down. If you were to look inside the function, you would thatt every time it is called, the file is opened, written to, then closed. The file opening and closing takes some time as does the actual file writing. You can put the file open and close outside the loop so that each is only done once. The time it takes to do the file writing is determined by the amount of data and the type of data. You are converting to text and that requires more bytes to store each data point. You could, save the data as binary. This will result in a smaller file and a faster write. You other option is to defer the file write until after the while loop terminates. You could wire the signal data type to the edge of the while loop and enable auto-indexing. Then, the array of signals or waveform datatypes could be written all at once.

 

Message Edited by Dennis Knutson on 04-17-2006 07:40 AM

Message Edited by Dennis Knutson on 04-17-2006 07:40 AM

0 Kudos
Message 4 of 4
(3,508 Views)