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: 

separate the column in txt without space

Solved!
Go to solution

hi,

 

i have a txt file which im able to read in Labview. i need to read the column and separate it accordingly. 

 

0000014123B --> 0000 014 123 B (from single column convert to 4 columns)

 

Meaning to say, the input need to be separate into 4 different column as above. attached is the txt file.

0 Kudos
Message 1 of 10
(3,021 Views)

Is it always 4 characters, then 3, 3, and 1?  If so, just use Substring.


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
0 Kudos
Message 2 of 10
(3,002 Views)

Take a look at this

Randall Pursley
0 Kudos
Message 3 of 10
(2,996 Views)

Hi Randall,

 

just slightly Rube-Goldberg… 😄

 

ParseString.png

No need to build lines and remove the EOL, to finally put all lines with their EOL chars in a spreadsheet string. Just do it with one function… (Your version might be more memory efficient with bigger string arrays.)

Best regards,
GerdW


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

GetFixedWidthColumns.png

 

Simple to use a loop to create dynamic search and replace strings based on an array of widths as well.

Message 5 of 10
(2,965 Views)

Hi Darin,

 

I really should learn RegEx someday… 😄

Best regards,
GerdW


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

hi, thanks for the quick response. can i have the vi since i am new to labview and not familiar with the palettes. thanks

0 Kudos
Message 7 of 10
(2,920 Views)

Hi,

 

it's a SNIPPET!

Best regards,
GerdW


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

hi,

 

i have created the vi as per in the image but i still cannot read the value.refer to the attachment. Can anyone advise me on that? thanks

0 Kudos
Message 9 of 10
(2,878 Views)
Solution
Accepted by topic author varsha88

Hi varsha,

 

- you forgot to enable the "Regular Expression" mode in the right-click menu of the parse function (did you notice the small star in the symbol?)

- you wired the TRUE constant to the  wrong input

- the second string constant should be set to \-code display mode (well, I guess there's a LabVIEW idea to show the display mode of string constants by default…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 10
(2,874 Views)