LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving an array of multi-line text cells in a format that can be read in later

Highlighted

Please post the code in 2011 version.

-----

The best solution is the one you find it by yourself
Message 11 of 17
(396 Views)
Highlighted

I do not have LabVIEW2011, only 2012 SP1.

 

I may have found out how to do 2011.  See attached vi.

0 Kudos
Message 12 of 17
(392 Views)
Highlighted

I will say that this seems like an overly difficult way to have to go for such a simple concept.

0 Kudos
Message 13 of 17
(390 Views)
Highlighted

If you don't care about the file format you can save the data to an xml file as suggested before or you can also write to datalog or bin file.

-----

The best solution is the one you find it by yourself
Message 14 of 17
(380 Views)
Highlighted

What you are trying to do is a simple concept, but it is not "natively" supported by higher level LabVIEW functions because it is not a standard file format.  Spreadsheet files have a well defined format, but you do not want to use that format, since it relies on end-of-line for field separation.  You have two options, both straightforward, but both requiring you to use more low level functions.  They are:

 

  1. Convert your strings to a form that can use the standard spreadsheet format.  To do this, replace all the end-of-lines (usually two characters) with some other sequence (e.g. "~|~"), then save to spreadsheet.  On read, replace the other sequence with end-of-lines.  Use Search and Replace String to make your life easier.
  2. Handle the file write directly yourself.  Write each string, separated by a custom separator. To fetch, read a chunk (or the whole file if it is small enough), search for the separators, and split into your array.  If you read chunks and your separator is multibyte, remember to search for partial bytes of the separator at the end of the chunk.
This account is no longer active. Contact ShadesOfGray for current posts and information.
0 Kudos
Message 15 of 17
(358 Views)
Highlighted

I had i similar problem:

I communicate with an API and the API only accepts CSV files as commands. And now I wanted a linefeed within a cell.

I have a 2D String Array with a couple of line feeds within some cells in Labview and everything looks fine. But after saving to a file, the linefeeds destroy everything.

After a couple of hours i found out:

If you want to have a linefeed or a cariage return within a cell, put one " at the beginning of your cell (string) and one " at the end of your cell (string). Now excel and other editors will show the file correctly and my API accepts the file.

Also play a little with the "convert EOL" otption by rightclick the "Read from/Write to Text File.vi".

 

 

 

0 Kudos
Message 16 of 17
(220 Views)
Highlighted

Here is a code snip to clarify what has worked well for me:

image.png

 

0 Kudos
Message 17 of 17
(154 Views)