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: 

NI_DataType and NI_ChannelLength odd behavior

When I read all properties of a channel in a TDMS file (LV2016) using the Get Properties VI with no property name wired, I get an array of variants (Values) and strings (names) with NI_DataType and NI_ChannelLength included.  If I then try to read those same properties as variants, NI_DataType and NI_ChannelLength cannot be read (Property not found).  All other properties seem to be readable as variants by simply not wiring the type input to the Get Property VI.

 

The only way to read those are to perform a separate read using U32 for NI_DataType and U64 for NI_ChannelLength.

 

Why do these properties behave differently?

 

Thanks,

 

XL600

0 Kudos
Message 1 of 5
(3,198 Views)

When reading your TDMS file, it sounds like you are trying to pull property details, which are very specific data types, for the NI_DataType and NI_ChannelLength. They won't be gathered by the "variant" data type, so if you try to pull the property information out using that function, try to leave the data type input unwired and see if you obtain the desired result; if not, the separate reads may be your best bet.

 

When you get the properties using TDMS Get Properties, the output is a variant including the NI_DataType and NI_ChannelLength, among other properties. That does not necessarily mean that those two properties are also of the variant data type when standing alone, hence the behavior you see in the TDMS Read function. The array of a variant data type allows for more flexibility in the data it can include. As described in the TDMS Get Properties Function help page (see details on the bottom of that page), both NI_DataType and NI_ChannelLength are integer values that correspond to a LabVIEW data type code and the number of values in a channel, respectively. 

0 Kudos
Message 2 of 5
(3,128 Views)

NI_DataType and NI_ChannelLength are attributes of a channel.  They need to be read with "Get Attribute" of the channel variant.


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 5
(3,124 Views)

I read both using the TDMS Get Properties VI with U32 (NI_DataType) and I64 (NI_ChannelLength).  The DataType does correspond to the LV Data Type, but it's not identical.  I just created a direct map between the types I expect in a TDMS log vs how I want to work with those inside LV.

 

Here's the example I generated to show the differences:

 

 

How would one read data from a TDMS file as a variant in order to use the Get Variant Attributes VI?  The TDMS Read doesn't accept variant or variant array as a datatype.

0 Kudos
Message 4 of 5
(3,110 Views)

Perhaps this forum post discussing reading/writing variant data to TDMS might help. 

0 Kudos
Message 5 of 5
(3,091 Views)