07-11-2013 10:32 AM - edited 07-11-2013 10:44 AM
I have very large TDMS files(GB range) and I am trying to import TDMS and decimate the TDMS file by taking every 20th sample point. Is there a VI out there that I can use for this? I am new to Labview and tried building the VI my self and failed.
07-11-2013 12:52 PM - edited 07-11-2013 12:53 PM
The TDMS Read VI has a count and offset control. So you can choose to only read at offset 0 a count of 1, then at offset 19 a count of 1, then at offset 38 a count of 1. This should be done in a for loop and using the i terminal to help determine the offset you should be reading at (i * 20) - 1 should do as you want.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-11-2013 01:51 PM
@Hooovahh wrote:
The TDMS Read VI has a count and offset control. So you can choose to only read at offset 0 a count of 1, then at offset 19 a count of 1, then at offset 38 a count of 1. This should be done in a for loop and using the i terminal to help determine the offset you should be reading at (i * 20) - 1 should do as you want.
First you increment by 19, then you give a formula that doesn't match what is needed.
All you need is take sample i*20 and write it into a new TDMS file.
07-11-2013 02:48 PM
@crossrulz wrote:
@Hooovahh wrote:
The TDMS Read VI has a count and offset control. So you can choose to only read at offset 0 a count of 1, then at offset 19 a count of 1, then at offset 38 a count of 1. This should be done in a for loop and using the i terminal to help determine the offset you should be reading at (i * 20) - 1 should do as you want.
First you increment by 19, then you give a formula that doesn't match what is needed.
All you need is take sample i*20 and write it into a new TDMS file.
Wow...well I guess I won't get the kudo for this one then.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-12-2013 10:39 AM - edited 07-12-2013 10:46 AM
Attached is the TDMS VI that I put together with your info. The problem I am running into is an Error 4 Occurred at TDMS Read in TDMS VI..vi End Of File Encountered. This happens as soon as it loops 3 iterations. How do I get it to read correctly? Could you please modify my VI so that it will work and attach it in a reply post? Please
07-13-2013 11:14 AM
I thought you wanted to grab every 20th sample. This code is nowhere close to doing that. First of all, your number of samples to read should just be set to 1. Use a while loop and exit when you get that End of File error. You will get that when you read the last possible value.
Give this code a try.
07-15-2013 08:15 AM
First off, I want to thank you very much for the help and the VI. Here is the problem I face now. The vi goes through the first loop(header info) and when it enters the second loop(actual data) it encounters the error code 4 End of File Encountered. What will fix this issue? Attached is a sample of the large file(which is TDMS, but I zipped it in order to post it), this might help us both understand how to get is get the final file that contains every 20th sample.
07-15-2013 08:33 AM
You actually just posted a shortcut to the data, which is useless to me.
07-15-2013 10:37 AM
I zipped it though WinZip which is a free software to download and enables you to unzip this file. I dont know of any other way to compress the file and send it via this post. Any thoughts?
07-15-2013 11:39 AM
Give this VI a try. It iterates over each group and channel and writes 1 sample at a time. You will want more descriptive channel and group names to make this work appropriately. With your given test TDMS file, all of the channels come out to "Untitled", so you only get 1 channel in the end.