LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a row or column delimiter for write to text file.vi

Solved!
Go to solution

Normally i would use a write to spreadsheet.vi to log my data, but since I am also saving my timestamp as string along with the data. I decided to use a write to text.vi function.  but my issue is my timestamp is writing in column but I want to be in rows. Please take a look help me if you can.

My data is not writing because I commented that part out and it works fine.

 

Admin Note - Attachments removed per user's request

0 Kudos
Message 1 of 11
(4,917 Views)

Transpose your data. The easiest way to do this is convert all of your data to an array of strings and then convert to spreadsheet string. The array of strings right before the conversion to string should be in the orientation that you desire. In general this is the more intuitive way to format your data before writing to file. Looking at your code, I really can't tell what's going on without analyzing each individual section. With an array of strings, you can probe the wire in the future and see if there's something weird going on.

 

Please include a Snippet of your code, or attach your VIs, so that we can better assist you. We are here to help, but won't spend all day recreating your code from scratch.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 11
(4,906 Views)

My apology here's the vi i still dotn know how to create a snippet.

 

Admin Note - Attachments removed per user's request

0 Kudos
Message 3 of 11
(4,890 Views)

For reasons beknownst only by the primitive author, the Array to Spreadsheet String function adds a (platform dependent) EOL constant to the end of the string for 1D arrays.  I usually strip whitespace from the end of the string or use the function from vi.lib:

 

http://forums.ni.com/t5/LabVIEW/Darin-s-Weakly-Nugget-1-10-11/m-p/1409328

0 Kudos
Message 4 of 11
(4,877 Views)
Solution
Accepted by topic author ritch_by_nature

See snippet here. I took your VI and made my own comments on it to better understand what you're doing. I then added code below for how I would generate your 2D array of strings. The way I did it should result in the rows being the way you want without needing to use the Transpose node.

save_BD.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 5 of 11
(4,875 Views)

Thanks Definitely a better simplify version

0 Kudos
Message 6 of 11
(4,855 Views)

Unfortunately the data still come up wrong

 

Admin Note - Attachments removed per user's request

0 Kudos
Message 7 of 11
(4,845 Views)

Problem fixed after couple tweaks

0 Kudos
Message 8 of 11
(4,815 Views)

What was the problem? Reading in as a concatenated string turned in to a 1D array instead of a 2D array?

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 9 of 11
(4,807 Views)

no at every iteration of the for loop, it took one sample of the timestamp combine with all the samples from the array of data with no comma separation. therefore not only it wrote the file in column but had no comma separation (in this format 9/1/143:44 PM01234567) but I tweaked it, It works now 

0 Kudos
Message 10 of 11
(4,800 Views)