LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

extract data from txt

Solved!
Go to solution

Hi guys

I want to plot "torque values" vs time from this txt file. My idea is to start moving data into an array starting after torque values, then doing the same to time values for a different array. I am struggling to get this specific data into an array. Can someone help me achieve this? 

0 Kudos
Message 1 of 11
(4,537 Views)

Hi hans,

 

this will give you an idea:

There are surely better ways to parse your text file!

(I just took the part containing the measurement data and parsed them "step by step" using plain string functions.)

Best regards,
GerdW


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

Hi GerdW, thank you very much for the reply.

The text file is generated from a machine and sent to a pc.I have no control over the layout of the txt file. My idea is to extract the data after the word "torque" and "time". I think you copied the txt file into labview and then just worked from there, so not quite what Im looking for, but I appreciate the effort. The idea is you just click a button and Labview will extract that information (torque and time) into two different arrays, which is the plotted. 

0 Kudos
Message 3 of 11
(4,501 Views)

GerdW said it was an "idea".  Your job now is to use a little imagination to make it suit your needs.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 11
(4,462 Views)

The whole point of the question is extracting specific data from the text file, not how to use it. Once i get the data into an array, its very easy to plot. So to be blunt, his answer helped nothing. 

0 Kudos
Message 5 of 11
(4,438 Views)

Hi hans, 

 


@hans7755 wrote:

The whole point of the question is extracting specific data from the text file, not how to use it. Once i get the data into an array, its very easy to plot. So to be blunt, his answer helped nothing. 


Well, my idea shows how to extract specific data from text/string.

All you need to do is to load the text file and find/filter the part with the measurement data.

 

In your first message you did not mention any buttons so I guess you know how to display a file dialog to allow the user to select a file...

Best regards,
GerdW


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

To put it bluntly, you definitely lack imagination.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 11
(4,431 Views)
Solution
Accepted by topic author hans7755

What the hell is going on here? Parsing a JSON file is not that easy.

 

Same developers share great code for JSON parsing.

 

Here is an example using JSONtext from JDP Science for your file.

snip.png

0 Kudos
Message 8 of 11
(4,424 Views)

Hi Martin Henz

This is exactly what I was looking for!! Thanks so much for the help, appreciated!

0 Kudos
Message 9 of 11
(4,405 Views)

Hi guys, I have a similar problem. I have to extract data from the columns of a .txt and plot it. The problem is that the file does not allow me to extract more than one piece of data. What is my problem in the block diagram?

Download All
0 Kudos
Message 10 of 11
(4,128 Views)