LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String and file parsing

Heys guys I have kind of a problem. I have a file that I would like to read in and parse some information from it. the information from the file looks like this
 
M23 N1 N2 N3 N4 I need just to delete the N in fron of each #. I do not know where to start when using the string functions. I have attached a copy of the file that I need to do this with. These files can get rather large.
 
I know it is probably easy but I just cannot think of where to even begin.
 
 
Intdac0.cir is how the file would be read and INTDAC2.cir is how I want it to look when finished.
 
Thanks in advance.



Joe.
"NOTHING IS EVER EASY"
Download All
0 Kudos
Message 1 of 11
(4,150 Views)

See attached.  This will parse for the N[0-9]+ string (a N followed by a number of any length) and remone the N.

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 2 of 11
(4,123 Views)
Can't you simply do a search for \sN and replace with \s?
Message 3 of 11
(4,115 Views)
I modified this from JoeLabview that he posted here.

Kenny
Kenny

Message 4 of 11
(4,104 Views)


@Dennis Knutson wrote:
Can't you simply do a search for \sN and replace with \s?


Well, there are N's that do not appear before a number.  ".OPTIONS" and ".END" for example.  I like Falkpl's solution.
Message 5 of 11
(4,099 Views)

Paul,

Thank you so much for the answer it works beautifully. You get 5 stars.




Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 6 of 11
(4,091 Views)


@jasonhill wrote:


@Dennis Knutson wrote:
Can't you simply do a search for \sN and replace with \s?


Well, there are N's that do not appear before a number.  ".OPTIONS" and ".END" for example.  I like Falkpl's solution.



I like Falkpl's solution too. I stripped the header off first and just did the search and replace on the data in the middle.
Message 7 of 11
(4,080 Views)

Do you think we could get it to put them in order like this:

M1 3 10 14 1 CMOSP M=32 L=1.75U W=2.45U

M2 14 3 1 1 CMOSP M=64 L=7U W=3.5U

M3 10 10 1 1 CMOSP M=2 L=1.75U W=2.45U

 

Just seeing if it could be done.




Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 8 of 11
(4,071 Views)
I have cut the string into a start, middle and end section. In the middle section I have replaced \sN with \s and sorted list according to M. After that the start, middle and end sections are concatentated together.
 
Example attached in 7.1
 
Hope this helps you out.
 
David
Message 9 of 11
(4,043 Views)

Tokenizing and parsing text can be a difficult problem.  When I was in graduate school I wrote a text compiler for a made-up language and computer architecture and got a greater appreciation for the topic.  I wrtote the code in c++ but was able to use two awsome tools, FLEX and Bison.  These were two tools writen in c which could take a set of rools for creating tokens (already avaliable in labview) and a grammar rule definition and parse a complex file.  It would be nice to see this aspect of labview expanded where an express vi allowed you to defile token list and a grammar and parse and or edit files with automatic code generation.  Unfortunatly I never get too much free time to follow-up on my ideas.  Glad to here my solution worked.

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 10 of 11
(4,029 Views)