01-06-2013 05:48 PM
Hi all,
I am trying to convert tdms files into lvm files using 'read from measurement file' and 'write to measurement file' .
The problem i am currently facing is the tdms has a whole channel is in string, I am not able to take that out and write the string in to the comment in the lvm file.
It would be great if somebody give a hint on how to do that.
I have attached the vi that i have at the moment.
I have searched arround in the forum, and got some code that provide in some posts, but those are not really working for me.
Thanks in advance.
Yifeng
01-07-2013 12:58 AM
Hi,
There is no way to write a string array as a channel in 'write to measurement file'. The 'signals' item only takes dynamic data type and a string array cannot be converted to dynamic data. The 'Comment' item is not used for raw data. It cannot store a string array as you expect.
Since the channel stores timestamp in string format, you can firstly convert it back to timestamp, secondly convert it to double, then store the double array into lvm file.
Actually, what I'm curious about is what requirement makes you want to convert TDMS files to LVM files. TDMS is well supported. Maybe there are easier ways to meet your requirement by using TDMS directly.
Thanks,
zaizhou.ma
01-07-2013 08:19 AM
As you have discovered, LVM files do not support arrays of strings. Looking at your data, it appears the array of strings is timestamps for the arrays of data which follow. I speculate you want this data as an X-column, followed by one or more columns of Y data. I have to reiterate the previous question - why are you doing this? Do you need LVM or will any text format do? If any text format will do, your problem is relatively simple. Read the data from the TDMS file, then write it to a text file using your own formatting. This is fairly easy to do, and is easiest if you do not use Express VIs, for either the read or the write. Express VIs are great, but only when they do what you want them to do. If not, you need to do it yourself. This is one of those cases. If your TDMS files are not very large, you can do the following:
This algorithm is straightforward, but inefficient. If you have trouble with either memory size or time to execute, let us know. There are ways to improve both memory use and speed of execution of this simple algorithm by orders of magnitude.