LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

text file to string array

I have a file of text with several lines of text. I want to place these lines of text into an array, with each line of text mapping to exactly one element in the array. I have a vi that does this, but it puts one line of the text into several array elements. Each line of text is about 50 characters. Is there a upper limit towards how many characters can fit into a string in an array of strings. What I wish to do is to read in a text file that begins with a commented section with the charaacter #. Each commented line begins with # and I would like to remove these parts out of the text file. I was thinking of reading the lines of the text in the file, and routing each line of text into a single element in the array, and then doing a text search on each element of the array in loop and then building another array based on the condition that the first element didn't begin with a #. If someone knows a better or more efficient way of doing this, please tell me.



0 Kudos
Message 1 of 3
(2,959 Views)


@Timothy 123 wrote:
 have a vi that does this, but it puts one line of the text into several array elements.

Your VI is faulty, then. 😉 You should be able to do this using "Spreadsheet string to array". There is no practical limit to the string lenght.

Attached is a simple demo (LV7.0)  that shows one simple possibility. If your strings are huge, some additional improvements are easily possible.


 

Message 2 of 3
(2,944 Views)
Thank you,

This is exactly what I wanted to do.
0 Kudos
Message 3 of 3
(2,932 Views)