LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array of Strings will not create new line with Writing to Text File

I am taking string data being read in from a binary file, iterating the cluster data, and converting each record from a cluster to array.  Then I am trying to write that string array of data to a text file to be stored on external memory (in an attempt to save flash memory on the RIO board).  However, when I go to write the next array of strings I cannot get the file to put it on a new line.  I have tried to add the end of line character, the carriage return character and I cannot get anything to work.

 

Please help

0 Kudos
Message 1 of 9
(5,063 Views)

There are a lot of Write to File functions in there.  Which one are you having problems with?

 

Did you try  Array to Spreadsheet String?  Or Write to Spreadhseet file?

0 Kudos
Message 2 of 9
(5,054 Views)

Hello Gerin99,

 

From your block diagram it looks as though you are taking an array of clusters of strings, auto-indexing that array, and then converting each cluster of strings into an array of strings before writing the strings to a text file, is that correct?  It doesn't appear that you are currently modifying the string array in any way.

 

Is this being written to an external USB drive?  Are you doing any conversion before reading the file elsewhere?  One thing to keep in mind is that the EOL characters used by one OS (VxWorks, Phar Lap) may not be the same as those used on another (Windows).  If you open the resulting file in a robust text editor such as Notepad++, do you see the EOL characters you introduced (probably CR or CRLF).

 

This might also be worth taking a look at:

 

KnowledgeBase: Difference between Carriage Return, Line Feed and End of Line Characters.

http://digital.ni.com/public.nsf/allkb/5A5A050A3019A573862575F30061D49B

 

Regards,

 

 

 

Tom L.
0 Kudos
Message 3 of 9
(5,052 Views)

RavensFan,

 

Sorry about that.  The other read/write functions are working fine.  The one I am having trouble with is where I right to the SD port on my sbRIO-9636 board.  When I open the file on a Windows based machine it appears all on a single line and I see no characters which might represent a cariage return or EOL.  I just see the last string of the first line mashed with the first string of the next line and one continuous bead of text.  The file is being written with the tab delimiter I call out in the actual data string/cluster, but it is ingoring the EOL I put at the end.  Does this have something to do with the fact that I am writing to the SD card?  I have attached a "zoomed in" version.

 

Thanks

0 Kudos
Message 4 of 9
(5,011 Views)

Hi gerin,

 

I don't see any EOL write routine in your snippet...

 

Btw. keep in mind: an EOL might not be the same for sbRIO and Windows!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 9
(5,001 Views)

0utlaw,

 

That is the exact loop I am having trouble with.  I am taking an array of clusters and indexing it and converting those into an array of strings to be written to a text file.  I have even tried using the Write to a Spreadsheet File function and had the exact same problem.  Then I took it a step further and stored all of the data into a 2D array and wrote it all at one time using the spreadsheet function...same darn thing happened.  I have never had this happen to me in the past, but this is the first time I am trying to write data to an SD card on my sbRIO-9636, could that have something to do with it?

 

Thanks

0 Kudos
Message 6 of 9
(5,000 Views)

GerdW,

 

The EOL is being placed in the original data cluster (you can see in the attached image).  I then store that data into the same binary file every 5 mins to the internal flash.  Then once I have consumed half of the available flash on the 9636 board I dump all of the stored data into an SD card on the 9636 board.  Am I losing the EOL character somewhere in the Write To Binary, Read From Binary, Write to Text process?  I recently tried to add a new EOL character to the end of the string array just prior to writing to the file and it did no good.

 

Thanks,

gerin99 

0 Kudos
Message 7 of 9
(4,997 Views)

Hi gerin,

 

why do you use a cluster (of strings), when an array of strings would result in the same text with less effort?

 

Still: an EOL on sbRIO might not be the same as an EOL on Windows. Did you read the context help carefully?

 

Did you check your files byte-by-byte with an hex editor? Can you verify you're missing some bytes?

Did you check the right-click menu of the write function?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(4,985 Views)

Hello everyone, i went through the comment. I am doing smilar things like a database where i have to put the student TP number, the time of returning back the equipment the specification of the equipment and the data or the QR code. My problem here is that i cant use only one excel file. whenever ii have to rename with a new name and also the data when being scanned is doubled and tripled at the same time.

any solution for this please

Download All
0 Kudos
Message 9 of 9
(4,818 Views)