LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

tdms delete bad data point

I have several tdms files with bad data points. I am trying to write a program that will delete the data point and not affect any other data, especially the file channel names and group names. I am wondering if anyone has a educated guess as to if it is easier to open them in excel and then run a macro to delete the data and then save it back as a tdms file or if it is even possible to do in just labview.

 

Thanks

Billy

0 Kudos
Message 1 of 10
(4,234 Views)

@Billy331 wrote:

I have several tdms files with bad data points. I am trying to write a program that will delete the data point and not affect any other data, especially the file channel names and group names. I am wondering if anyone has a educated guess as to if it is easier to open them in excel and then run a macro to delete the data and then save it back as a tdms file or if it is even possible to do in just labview.

 

Thanks

Billy


Are you sure deleting the bad data is the way to go?  Wouldn't that shift all the remaining data in time?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 10
(4,218 Views)

You cannot delete data from a TDMS file like you can other files.  It is meant to be write only for the most part and all you can do is add data.  That being said you can read the entire file, filter out data that has been read, then make a new file with the subset of data in it.  This is usually not a good idea because it can be seen as tampering with the recorded data.  With an ASCII file I can just open a failed report in notepad and change it to be passed but with TDMS you can't.

0 Kudos
Message 3 of 10
(4,216 Views)

I do want to delete the data there is no time stamp associated with it, it is only a force and displacement data, however it is very large, I would like to do it in tdms becuase we make several files off of that including excel and trv files. In some instances where trv files are needed the data is just deleted in note pad however I would like to delete it at a higher level. I saw the edit tdms file and am trying to use this, making a copy or overwriting is ok but I can figure out what there number is that I should search the array for. In excel it shows up as #nv and in note pad as NaN but I dont know what it is in TDMS files, it needs to be a number but I dont know what number it is. If anyone knows what the number is that would be a lot of help.

 

Thanks

Billy

0 Kudos
Message 4 of 10
(4,214 Views)

@Billy331 wrote:

In excel it shows up as #nv and in note pad as NaN but I dont know what it is in TDMS files, it needs to be a number but I dont know what number it is. If anyone knows what the number is that would be a lot of help.


It needs to be a number?  No it doesn't, that's what NaN is (Not a Number).  If I divide a value by 0 I get NaN.  When you go to log it in TDMS that's what it will log.  Excel doesn't know what NaN means so it replaces it with No Value.  There are other ways to get NaN other then dividing by zero, like trying to detect a frequency tone when there isn't enough data, or reading a channel from CAN data when there was no message.

 

An easier way to fix this might be to check if the data is NaN and then just not record it.  Under the comparision palette there is a "Not a Number?" function.  You can use this to decide if you want to log to TDMS or not.

0 Kudos
Message 5 of 10
(4,208 Views)

Ok Thanks I see that now 

0 Kudos
Message 6 of 10
(4,202 Views)

I have one more question, when i open my new file it has all of the data for the first sample, or whatever the tabs in the excel document are technically. I dont know how to get the tdms read to read all of those so that I will have a 3D array if possible. I basically need a way to read all of the data not the first sheet. Also it removes the channel names and I would like to include them. If it will do this on its own if I overwrite the file than that is no a problem its just that it is not keeping them when they are copied.

0 Kudos
Message 7 of 10
(4,199 Views)

@Billy331 wrote:

I have one more question, when i open my new file it has all of the data for the first sample, or whatever the tabs in the excel document are technically. I dont know how to get the tdms read to read all of those so that I will have a 3D array if possible. I basically need a way to read all of the data not the first sheet. Also it removes the channel names and I would like to include them. If it will do this on its own if I overwrite the file than that is no a problem its just that it is not keeping them when they are copied.


Each tab in Excel other then the first one is called a Group in TDMS.  Each column in Excel in each tab, other then the first, is called a Channel.  Each Row within a Column, within a tab, other then the first tab, is called a sample.

 

Once you understand this reading with TDMS is much easier, you specify the tab name as the group, then the column name as the channel, then tell it how many samples to read.  Likely you want to read all so leave the length unwired.  This will return a 1D array of data.  You can specify multple channels to read at once and the data returned will be a 2D array of data.  If you want all samples for all channels, for all groups you can use a For loop reaching each group one at a time.

 

I don't know what you are talking about when you say that it removes the channel names.  You may not have specified one so it will pick Untitled or something like that.

Message 8 of 10
(4,189 Views)

You can use TDMS File Viewer or TDMS Read to see what exactly is the "#nv" value recorded in the TDMS file. As to delete data in TDMS file, so far, the only possible way with LabVIEW is as Hooovahh said, "read the entire file, filter out data that has been read, then make a new file with the subset of data in it." It might not be convenient but it can achieve your purpose. 

Message 9 of 10
(4,169 Views)

So I got it to find it and delete the data. But the data is in pairs, two columns in the excel file. I am trying to delete the next data point but I am struggling right now. I have attached my vi I know its messy but it works... almost

0 Kudos
Message 10 of 10
(4,146 Views)