LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trick on separating lines has random string but; at the end from textile

I have a text file like below (I copy 2 loop from the whole code) as you can see all these string and numbers are random. I want a code that can separate the blue part of the code for me in array.everything under {   }; I used match pattern but its only get the first loop and not for the whole code.

 

BLOCK

{

                ABCD_BSU2_TSET <BSU_ ORCAM _CED: 0x000> 32 KLC="hclk"

                {

                DER_KHU_1_0   7:6 NUM DEF=0x0 RW;

                FRTY_1_RTGC   5 NUM DEF=0x0 RW;

                FG_DERF_1_0   4:3 NUM DEF=0x0 RW;

                K_DF_SWRD_DHDDI   2 NUM DEF=0x0 RW;

                L_DFTF_SHDD_DH   1 NUM DEF=0x0 RW;

                SHDDU   0 NUM DEF=0x1 RW;

                };

                ABCD_BSU_LLP <BSU_ORCAM_CED: 0x004> 32 KLC="hclk"

                {

                HDGDFD   7 NUM DEF=0x1 RW;

                EDT_n   6 NUM DEF=0x1 RW;

                HGD_l_SDR_5_0   5:0 NUM DEF=0x19 RW;

                };

the rest of the code

.

.

.

}

0 Kudos
Message 1 of 38
(3,121 Views)

Put your Match Pattern inside of a While loop.  Make it stop when the expression can't be matched (index will be -1).  You will also need to keep track of the Index After Match in a shift register so that you don't repeatedly get the same set.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 38
(3,078 Views)

I have already tried that. but the loop does not take my 2D array input string. i tried to add 4loop but did not help. ....for regular expresstion are you using ; or {}; ? which one?

0 Kudos
Message 3 of 38
(3,055 Views)

I don't know where you came up with a 2D array.  Here's what I came up with.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 38
(3,051 Views)

@razii wrote:

I have already tried that. but the loop does not take my 2D array input string. i tried to add 4loop but did not help. ....for regular expresstion are you using ; or {}; ? which one?


Don't read the file using "read from spreadsheet file". Use the plain "read from text file", giving you a plain string..

Message 5 of 38
(3,040 Views)

please ell me what I am doing wrong! I only get the first loop and i dont know how to make it continue.

 

0 Kudos
Message 6 of 38
(3,024 Views)

sorry wrong file look at this one

0 Kudos
Message 7 of 38
(3,019 Views)

Why don't you use the code suggested above?

Message 8 of 38
(3,013 Views)
  1. Initialize your numeric shift register to 0
  2. Don't wire the initial string into the string shift register.  You want to pass it in using a tunnel.  Actually, you don't even want the shift register anyways.
  3. Use the Index to Start for your first Match Substring.  Pass the Index After Match of this function to the input of the next.
  4. You will need to autoindex the matched portion out of your loop.  This will result in a 1D Array of Strings.  Adjust your later logic accordingly.

GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 38
(3,004 Views)

 

I did but I get all the code to my output .. can not see what he is using after loop, insted I used "spreadsheet string to array" ..

0 Kudos
Message 10 of 38
(2,992 Views)