05-11-2015 04:55 AM
Anyone can help I have a CAN message logged from a TDMS file and wanted it to convert to a csv or a txt file with the following channel groups:
CAN ID, CAN Message, Timestamp, TX/RX
However the result that I got on my text file is not the same as the result from the TDMS.
I mean the layout becomes like this:
CAN ID, CAN Message,
Timestamp, TX/RX
I am wondering why does the Timestamp and TX/RX were put on the next line?
This is the snapshot of my code, anyone can help?
Thank you
05-14-2015 04:26 AM
Anyone can answer?
I notice the behavior when it reached the transpose array.. the result is like this
AAA, 00 00 00 00 00 00 00 00 00, <Time stamp value>, TX
BBB, 00 00 00 00 00 00 00 00 00, <Time stamp value>, TX
CCC, 00 00 00 00 00 00 00 00 00, <Time stamp value>, TX
DDD, 00 00 00 00 00 00 00 00 00, <Time stamp value>, TX
Which is im expecting it will be logged the same for text file.
However when i opened the txt file. it became like this
AAA, 00 00 00 00 00 00 00 00 00,
<Time stamp value>, TX
BBB, 00 00 00 00 00 00 00 00 00,
<Time stamp value>, TX
CCC, 00 00 00 00 00 00 00 00 00,
<Time stamp value>, TX
DDD, 00 00 00 00 00 00 00 00 00,
<Time stamp value>, TX
I managed to check the formatting it happened that after the 8 bytes of data, it become /n/r <--- which is I believe a format for next line. How come it didn't follow the array instead it moved the index 2 and 3 to next line?
Anyone can correct what am I missing?
Thank you very much !
05-14-2015 05:56 AM
Could you add your TDMS file to attachment pls.
05-14-2015 06:21 AM
Your real problem is likely in the program that creates the TDMS file. It is likely adding the End Of Line characters to the data string. My magic 8 ball says you use Array To Spreadsheet String on the data to then save it to the TDMS file. You should use the Trim White Space after the Array To Spreadsheet String in order to prevent that.
As far as your conversion program, you can use Index Array to get the data column, a FOR loop with the Trim White Space, and then Replace Array Subset to remove the EOL characters and then save it to your text file.
05-14-2015 10:52 PM
@crossrulz wrote:
Your real problem is likely in the program that creates the TDMS file. It is likely adding the End Of Line characters to the data string. My magic 8 ball says you use Array To Spreadsheet String on the data to then save it to the TDMS file. You should use the Trim White Space after the Array To Spreadsheet String in order to prevent that.
As far as your conversion program, you can use Index Array to get the data column, a FOR loop with the Trim White Space, and then Replace Array Subset to remove the EOL characters and then save it to your text file.
ahhh yes I used Array to Spreadsheet string in my program, I will give your advise a try 🙂 Thank you very much !