LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve data block from a complicated string

Solved!
Go to solution

Hi,

I ran a shell command on LabVIEW using System ExecVI and the result was returned as a string.

I want to retrieve a data block from the string. But the content in the string is very complicated.

Anybody has a good idea to find and retrieve the data block?

 

I have attached the returned string as a text file.

 

The data block has three columns with column labels as:

ORDINATE, ERROR, ABSCISSA

, but with additional graphical letters on the right of each row.

It is hard to explain and you may understand what I meant by taking a look at the attached file.

 

The data block I need starts from

"*+++++++ CHOSEN SOLUTION +++++++++++*"

and ends at

"*0LINEAR COEFFICIENTS*"

 

If you can suggest me the functions, I will try to create the code by myself.

Thank you in advance.

0 Kudos
Message 1 of 4
(1,282 Views)

Yes, it is not easy as your shell script creates graphs using character and data arrangement is quite special to make it readable but not easily parsable.

 

In terms of what functions to use, it would just be the string palette and array palette - but it depends on how clever you use those functions to make it scalable.

 

Good thing is that all columns are of fixed characters width. This is how I would approach this,

  1. Find the line containing " ORDINATE ERROR ABSCISSA" (line#815 in your example file)
  2. For each line after the header line
    • Check if it is of the format "3.046E-04 2.6D-04 5.00E-05" (use the appropriate scan from string format)
    • Scan into three values - corresponding to ordinate error and abscissa
    • If the line does not contain data of the format, this means it is the end of data (look for scan from string error)

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 4
(1,264 Views)
Solution
Accepted by topic author Xiang00

Couldn't resist solving this, here you go.

santo_13_1-1649906857314.png

 

VI in LV2016 attached

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 3 of 4
(1,256 Views)

Thank you very much for the kind suggestion and vi.

It solved my problem.

0 Kudos
Message 4 of 4
(1,248 Views)