From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

get data from text file

Hi, as attached below is a textfile that contains some values. I wish to know how may I retrieve all the values in column 1 and all the values in column 2?

Thanks.

0 Kudos
Message 1 of 5
(2,348 Views)

Hi Fred,

 

- Do you start counting with 1 or with 0 (zero)? To be more clear: Do you need the "names" of the parameters or just their values? Should the 3rd column be disregarded?

- Can you reformat that text file to use only one single separator between "name" and "value"? Right now you're using a lot of spaces where a single tab would be sufficient...

- Do you also need the date/time values? Can you switch to "standard" without that AM/PM stuff?

 

Solution steps:

- Read the text as string

- replace all consequutive spaces by single tabs

- use SpreadsheetStringToArray

- use IndexArray to get 1st and 2nd column

 

Edit:

This thread seems highly related to this one...

Best regards,
GerdW


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

What do you mean by do I start counting with 1 or 0 (zero)? The 3rd column should be disregarded because I intend to retrieve the value from the first two columns and feed it into a polar plot vi and plot an ellipse. Is this possible? The text file that I attached is just an example so the spaces, date and time values with the AM/PM stuff depends on how each user datalog files look like. Actually the reason why I want to retrieve values from the text file is because I need to show an ellipse on my front panel and its synchronize with the graylevel value that is also retrieve from the text file. text file.png

This is what I have done so far, but the subarray indicator would return me the value of row 9 in my text file. So can you please tell me what change do I need to make?

 

 

0 Kudos
Message 3 of 5
(2,314 Views)

As for the how do I retrive a particular line from my text file question on the duplicate thread. How do you wire a "13" to the ReadLine function?

0 Kudos
Message 4 of 5
(2,306 Views)

Hi Fred,

 

I would wire a 13 to the count input:

check.png

How would you interpret the context help?

 

"Actually the reason why I want to retrieve values from the text file is because I need to show an ellipse on my front panel and its synchronize with the graylevel value that is also retrieve from the text file."

That's what I would do:

check.png

Best regards,
GerdW


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