LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delimiter Question

I am using the "Write Characters to File.vi" to write several strings to a text file. However I'd like to somehow get a delimiter in the file process so that when I view my data in Excel for example it can appear in consective columns, not as one long column as it does now.

I'm a little confused as to how to go about this, and if someone could provide an example with some guidance I'd greatly appreciate it. I can provide a screen shot of a portion of the vi if it would help. I'm using LV 7.0.

Thanks...
Using Labview 7.0 and 2010 SP1 with Windows XP and 7.
0 Kudos
Message 1 of 8
(3,199 Views)
Open Write to Spreadsheet File (Double click it) and you will find instructions on its BD on how to change it to write string arrays. Save it in a different location. Do the same to the read VI.

___________________
Try to take over the world!
0 Kudos
Message 2 of 8
(3,190 Views)
Use Concatenate strings and insert a Carriage return between lines. A Carriage return constant is available on the String functions palette.

Lynn
0 Kudos
Message 3 of 8
(3,187 Views)
I've attached a screen shot of a portion of my vi. Forgive me for the messy wiring and disorganization as I am still in the development stages. The file created with the "_pm" extension contains the actual measurement data. It will range in length from 1024 rows to 2048 depending on the data. Right now this data is being saved all in one column. I'd like to have it in multiple columns, each the correct length. This seems to be my problem, getting the new data set to start in the next column over.

The second file created with the "_pp" extension will contan headers for this data and needs to be the same way, start saving in the next column over for the next data set.

I'm not sure if this can be done with the "write to spreadsheet.vi" or not. I think maybe I wasn't making myself clear. My vi runs in a loop until I stop it, so there will be much data saved and needs to be saved all in the same file, until I start a new file.

Any advice to help me on this, I'd greatly appreciate. Thanks...
Using Labview 7.0 and 2010 SP1 with Windows XP and 7.
0 Kudos
Message 4 of 8
(3,181 Views)
You cannot append a new column to an existing file.

A file is just one long string, and appending a new column would mean that you need to interlace the values. This is not possible.
As a direct solution, you need to always read the entire existing file, merge the data, then overwrite the existing file with the new construct.

A better solution:
Do yourself a favor and write a single row each time. For this you need to sperate your fields with tabs instead of line feeds when you concateneate all the strings. Now you can append to the existing file, because each data set is a new row.

You can always transpose it later if needed.
Message 5 of 8
(3,146 Views)
Thanks for the suggestion. For my main measurement file this worked fine, I simply removed the transposing option I had and now I have the data in rows.

However for my header file I replace the return function as you suggested with the tab function and it doesn't seem to work correctly. I have attached the text file as an example as what I am getting out. It looks like it wants to put them in rows but then just moves the whole set over to a different column and only puts two headers in the same row. As I said before I'd like to the 5-7 headers I may have all in the same row and then the process would start over once new data is appended and written to the file. It would of correspond to my main measurement file and the two files could be compared later.

Any ideas on what I may be doing wrong?
Using Labview 7.0 and 2010 SP1 with Windows XP and 7.
0 Kudos
Message 6 of 8
(3,123 Views)
Here's the file. I think I forgot to post it last time.
Using Labview 7.0 and 2010 SP1 with Windows XP and 7.
0 Kudos
Message 7 of 8
(3,117 Views)

@MAH2681 wrote:
Any ideas on what I may be doing wrong?


Drop your use of "Build array" and ""Array To Spreadsheet String" in building the header.
The "Array To Spreadsheet String" function inserts an EOL to separate rows.

Just use the Number to Fractional String and concatenate (with tabs inserted appropriately and concatenating an EOL constant as the last thing). Attached jpg shows what you're getting and don't want (the "\r\n" in "\" code display).

Edit for typos.

Message Edited by Donald on 04-20-2005 05:00 PM

=====================================================
Fading out. " ... J. Arthur Rank on gong."
0 Kudos
Message 8 of 8
(3,106 Views)