From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Rename Group in TDMS File

Does anyone know how to rename a group in a TDMS file?

 

I have a TDMS file with 90 groups, each containing 4 channels.  I would like to rename the groups within the file while leaving everything else the same.  Thoughts?

 

thank you,

Scott Otterbacher

0 Kudos
Message 1 of 16
(5,892 Views)
I know of no easy way, but knowing the data types of the channels, you could use the TDMS functions to read the file and then write the data to a new file with new group names.
0 Kudos
Message 2 of 16
(5,882 Views)

In LabVIEW 2009, set the property "name" to the new group name (with the old group name wired as group name to "Set Properties"). In older versions, use the property name "NI_UpdateGroupName" instead.

 

"NI_UpdateGroupName" can still be used in LV2009. Besides renaming a group, it can also be used on a channel, which will move this channel from it's current location into the specified group.

 

Herbert 

Message 3 of 16
(5,862 Views)

Sorry about exapanding this Q a bit but what about deleting a channel? I want to replace old bad data with a new set. I have used the re-name to get it out of the mix but I would really like to be able to delete channel data.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 16
(5,860 Views)

Unfortunately, shipping versions of LabVIEW don't have any built-in features for that. You would need to copy your file using the TDMS functions and leave out the data you want to delete. A potential built-in LabVIEW feature for this would actually have to do the same thing. While we could relatively easily expand the file format to make groups or channels invisible, we would have to copy the file in order to remove the values of the deleted channels.

  

This is a fairly common request, and we're currently looking into that.


Thanks,

Herbert

0 Kudos
Message 5 of 16
(5,851 Views)

Thanks for the great input.  However, I'm still having some problems.  I have a for loop that runs through all the group names and at each iteration takes in the original and revised group names as inputs into TDMS Set Properties.  Some of the groups go to the correct new names, but some get changed to incorrect ones.  Attached is a copy of the VI.  I'd include one of the TDMS files as well, but each are about 20Mb.


The TDMS file contains about 90 groups that are decimal strings which relate to antenna azimuth direction.  When I collected the data I did not reference the azimuth to north, but rather I just pointed the antenna north and noted what position I was getting from the encoder (i.e. North = 156 deg).  Now I want to go through and change the group names to be referenced to north = 0 deg.  So I read in the array of group strings, convert to integer, subtract 156 or add 204, depending on the value, and then convert that new number back to a string and send it to the TDMS Set Properties function.

 

I am unsure if my problem is how i'm passing the arrays into the for loop or if it's how i'm using TDMS Set Properties.

 

Here is an example of what happens:

original groups: 5,8,13,17,20,25,28,32,36,etc...

desired groups: 209,213,217,221,224,229,232,236,240,etc...

new groups: 53,57,61,65,224,73,232,236,240,etc...

 

The first few are wrong, but then the 5th is correct along with the 7th, 8th, and 9th.  5 of the groups after that are also correct before it goes back to an erroneous one.  The wrong group names seem to be from the array of correct names, but just from the wrong index of the array.  This seems odd because the for loop should be reading in just one array value at a time, and in the correct order from beginning to end.

 

Hope you can help out a confused labview newbie.

0 Kudos
Message 6 of 16
(5,828 Views)

Hi seotterb,

 

I tried in both LabVIEW 8.6 and 2009, created groups:  5,8,13,17,20,25,28,32,36 and then used your VI, the groups were successfully renamed to:  209,212,217,221,224,229,232,236,240. Is that convenient for you to zip and post your files here as well?


Thanks.

0 Kudos
Message 7 of 16
(5,817 Views)

Attached are two files containing the .tdms and .tdms_index files.  I split it into 2 because of the maximum attachment size.  Additionally, they are both named *.zip, but are actually rar files.  Because .rar is not a valid extension for an attachment I renamed them to .zip.  To uncompress, change the .zip extension to .rar on both and them.

Download All
0 Kudos
Message 8 of 16
(5,796 Views)

Hi seotterb, 

 

The file you attached has already been converted, right?

 

After check your file I find that it is corrupted. Originally you have lots of groups: 5,8,13,17,20,25,28,32,36,etc... If you want to rename group 5 to 209, you should fail since 209 has already existed. 

 

Is that possible for you to attach the original file on the forum? Then I can debug into the converting part. 

0 Kudos
Message 9 of 16
(5,769 Views)

That file is the original, it hasn't had the groups renamed by the VI yet.

 

I think you're right about failing on the rename of 5 to 209 because 209 already exists as another group in the file.  That problem hadn't occurs to me, and explains why some groups rename correctly (no same group name) and others don't (existing same group name).

 

Unless someone out there can figure out a work around for this, I guess I'll just read out the data and save it into a new file with the proper group names.

 

Thank you all for the help on this.

0 Kudos
Message 10 of 16
(5,767 Views)