LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can arrays be added as custom data to TDM's channel group property?

So after attending the LV Developer's Day, I figured that I should use TDM file format to save data of my files instead of using text files due to its capability to import into excel and also its structure. I haven't had much experience with TDM files.  I'm wondering if if it is possible to add an array of properties to the channel group property.  I would like to save data such as output lines to my NI card.  The body of the tdm file will consist of sequences of how the output lines would send data.  Thanks
0 Kudos
Message 1 of 5
(2,496 Views)
The TDM storage format doesn't directly support arrays for channel or channel group properties. By default, for a channel group you are limited to a Name, Description, and three Free Text inputs. You can also use the Set Property VI in the Advanced storage palette to manually create as many new properties as you like. This is one way to input an array as a property. You could create individual properties for each array item. An easier way to accomplish this might be to use one property for all the array items. Then convert your string array into a tab-delimited string using Array to Spreadsheet String in the String palette and set the property's value to this string. Then you could read the property out of the TDM Channel Group using the Get Property VI in the Advanced storage palette. Convert the property back into a string array using the Spreadsheet String to Array VI, also located in the String palette. I've attached a quick example below written in LabVIEW 8. Let me know if you need an earlier version. I'll also attach a screenshot so you can get a quick look at what I'm doing. Hope this helps!!!

Message Edited by Jarrod S. on 04-11-2006 04:30 PM

Jarrod S.
National Instruments
Download All
0 Kudos
Message 2 of 5
(2,482 Views)
This makes sense, I will try it this way.  Thank you very much Jarrod
0 Kudos
Message 3 of 5
(2,468 Views)
I tried that process you showed me.  Instead of doing the array to spreadsheet, I convert my arrays by using the flatten_to_string.vi.  I checked to see if the data are being written by putting an indicator right before it enters Write Data vi and the data is there.   The problem is that I don't see any data when trying to read from it.  Oh and i'm using LV 7.1.1

Message Edited by supernatural on 04-12-2006 10:57 AM

0 Kudos
Message 4 of 5
(2,467 Views)
I tried the method you suggested in both LabVIEW 7.1 and 8.0 and got varying results. Neither worked correctly, but for different reasons. I'll explain both below:

LabVIEW 7.1:

The Write Data VI doesn't accept strings with any non-displayable ASCII characters for descriptions or free text. The Flatten Data to String flattens data to a binary image of that data, so it obviously includes many non-displayable characters, such as the ASCII null character '\00'. The Write Data VI does accept tab characters, so you are still able to use the method I showed above, changing the array into a tab-delimited string. I'll attach a 7.1 version of that example below.

LabVIEW 8.0:

LabVIEW 8.0 is much closer to working for the scenario you listed, but it still fails. The Write Data function will accept most non-displayable ASCII characters in a string, but it decides to terminate a string when it first encounters the ASCII null character. This is similar to C Strings, which can be of any length and are terminated by the ASCII null character.  The problem here, is that if you use Flatten to String, the result will doubtlessly include the ASCII null character somewhere.

So you have two options here:
1. The method I listed in the previous post.
2. Actually create a channel in your channel group whose sole purpose is to store this string array data. Then you can flatten the string array to string and use the String to Byte Array to create a numeric array that the Write Data will accept in its Signal input for the channel.

Message Edited by Jarrod S. on 04-12-2006 01:44 PM

Jarrod S.
National Instruments
0 Kudos
Message 5 of 5
(2,453 Views)