Discussion:
Number of elements in TDMS file
(too old to reply)
knapkerd
2008-06-13 07:40:09 UTC
Permalink
Is there a way to determine the number of elements in a TDMS file?  The files I am creating have several signals all of the same length.  The only way I can think of is to do this is put it in a loop and read one element at a time until it reaches the end of the file.  But, my files will have millions of elements.  Any suggestions?
 
Thanks.
--Robert
Herbert Engels
2008-06-13 07:40:10 UTC
Permalink
Use "TDMS List Contents" in order to find out which objects your file contains. Loop over the results and read the property NI_ChannelLength from all objects. Some objects (e.g. groups) will not have this property, but all channels will have it. This is the number of values in the channel. Add up the numbers and you're done. Hope that helps,Herbert
knapkerd
2008-06-15 23:40:04 UTC
Permalink
That should do it.  Thanks!
--Robert
knapkerd
2008-06-16 00:10:05 UTC
Permalink
Sorry, I jumped the gun.  I thought that I might be able to use get property from signal, but all I have is the channel name.  How do I read the length from the object? 
 
Thanks.
--Robert
Herbert Engels
2008-06-16 00:10:05 UTC
Permalink
It's a read-only property called NI_ChannelLength (data type is I64). You can see it in the TDMS File Viewer. Make sure to check the "found" output on "TDMS Get Properties", because groups and empty channels don't have that property.Herbert
knapkerd
2008-06-16 00:40:04 UTC
Permalink
Works great.  Thanks!
 
--Robert

Loading...