LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

converting the text file content to string

Dear Friends,

I have the following problem.

I want to have a button on the front panel.  When you press on it, and it should let me to choose a text file.
When running the code, it should go to  this text file, read it and record each row in a string.

the content of  A.txt file looks like this:

c100a3ff001
y10s10013ff
a1c000003ff
....................
....................
.
at the end I just want to have them in a single string.

Can someone help please?

(if possible please with a .vi )
my current version of LabView is 7.1

Best Regards


0 Kudos
Message 1 of 6
(3,524 Views)
Hi blue,

have you looked at the examples coming with LabView?
In the file palette you will find functions to:
- bring up a file requester to choose a file
- wire the path delivered from this function to "read text from file" or "read spreadsheet file"
- as result you get a string or an array of strings!
- if the result is a scalar string you can use "spreadsheet string to array" (string palette) to convewrt to an array of strings
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(3,518 Views)
can you post maybe a vi in LabView 7.1 which does this operation ?

thnx alot!
0 Kudos
Message 3 of 6
(3,470 Views)
Hi blue silver,

the attachment does exactly what I described before Smiley Wink
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 6
(3,451 Views)
can I read a text data of 10 MB (consisting of 3 hex numbers each 3 digits) without any problems? , read it as string and save in a row ? This makes around 2 million array elements ! You think It will crash? up to now I worked with 2 MB files which alone takes some seconds just to load the file!
0 Kudos
Message 5 of 6
(3,414 Views)
Hi silver,

yes, you can load 10MB of text without any problems (unless your computer only has 8MB of RAM Smiley Wink).
And yes, it will take some time to convert from text to number - also depending on your computer...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 6
(3,405 Views)