LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array spreadsheet format

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 youArrayToSpreadsheet.jpg

0 Kudos
Message 1 of 5
(2,750 Views)

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 !

 

0 Kudos
Message 2 of 5
(2,683 Views)

Could you add your TDMS file to attachment pls.

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

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 5
(2,665 Views)

@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 !

0 Kudos
Message 5 of 5
(2,633 Views)