LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Number of elements in TDMS file

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
0 Kudos
Message 1 of 11
(7,496 Views)
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
Message 2 of 11
(7,492 Views)

That should do it.  Thanks!

--Robert

0 Kudos
Message 3 of 11
(7,464 Views)
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
0 Kudos
Message 4 of 11
(7,461 Views)
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
Message 5 of 11
(7,458 Views)
Works great.  Thanks!
 
--Robert
0 Kudos
Message 6 of 11
(7,455 Views)

Hello!

 

I dont't get the property value NI_ChannelLength and NI_DataType from a tdms file using the 'TDMS Get  Properties' vi.

All other properties are returned.

Inputs to  TDMS Get Properties: GroupName: RFbeam; ChannelName: Dev1/ai6.

Output: Variant on output 'property value' (wiring I64 to datatype input does not solve the problem. 

 

These properties are displayed in the TDMS File Viewer however. I marked the missing props with NOK:

 

 TDMSscreen.jpg

 

What am I missing? Thanks for tips!

Klaus

Message Edited by Klaus M on 02-09-2010 10:56 AM
0 Kudos
Message 7 of 11
(7,029 Views)

This is weird in that the TDMS File Viewer does exactly that ("TDMS Get Properties" wired with group and channel name, but no property name or type). You might want to look at the "File Contents: Value Change" event in "TDMS - File Viewer.vi" and double-check that your code does the same thing.

 

Herbert

Message 8 of 11
(7,024 Views)

Thanks Herbert

 

For readers having similar problems, here are my experiences:

 

It works either without wiring a property name and datatype, as you mentionned before.

Resulting is a variant array. Result see attached solutionVariant.jpg

 

It also works wiring the right datatype as in the TDMS File Viewer and your first explanations:

Resulting is the channel length as Integer I64 or U64. Datatype constant representation and indicator representation must match!

See attached solution.jpg

 

My error has been wiring a string "I64" as datatype and a string indicator as value indicator. So stupid...

 

Regards

Klaus

 

 

 

 

 

 

 

 

Download All
0 Kudos
Message 9 of 11
(6,989 Views)

You can wire any data type that LabVIEW can automatically coerce the value to. In this case, that would be any numeric data type (obviously, the range of potential values for I8 or U8 might be too small). Coercion between numerics and strings cannot be done.

 

Herbert

0 Kudos
Message 10 of 11
(6,979 Views)