LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Match String

Hello;

I have a string coming from serial port and it is in the loop. So every loop I have a string contains 5Charectors then ':' then three numbers with ',' between each. Length of numbers are varied.

I want to get them in the Excel sheet. Right now, all coming like just one string. If I want to have them in the seperate Column, could you help on this?

 

I tried Sting/Split I didn't see any change. Then I tried to use Substring, since the length of numbers are changed in every loop I cannot set exact offset.

Then I thought may be RegExp canbe a good option, and search for comma ',' but I have a problem in implement it.

 

Thanks a lot for any idea;

sb

0 Kudos
Message 1 of 7
(3,517 Views)

Hi skh,

 

I'm not entirely sure what's the problem, so I can suggest something like the attached file.

In that part I receive a file name:

H10 nzl 787 1500 psi 40 kHz 4.4V  6spf 700ns_LTS_A Data094924.006

and I want to get only "787," so I  search/split string to omit all of the characters before it, then I use replace substring function with the required number of space to only obtain "787."

From there you can just build an array in the loop to store all of the strings and then write to file, or you can write to file while inside the loop, depends on your preference......

Hope this helps,

 

 

0 Kudos
Message 2 of 7
(3,503 Views)

Hi, here is an example of what i think you want.

LabVIEW 8.2,8.6,2009...still learning 😛
Download All
0 Kudos
Message 3 of 7
(3,491 Views)

The first part can probably be solved like this:

interpret string.png.

 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 7
(3,476 Views)

Hi, nice work  Yamaeda. Only one thing, since he has 5 characters than "." than 3 numbers with "," in between, shouldn't his format string be:

 

%5s.%f,%f,%f

 

 

 

LabVIEW 8.2,8.6,2009...still learning 😛
0 Kudos
Message 5 of 7
(3,469 Views)

Hi;

Thanks all for you r help.

First Sorry for the late reply, I didn't recevie notification.

 wond3rboy : I tested your solution. It works nice, I can see the seperate values in the front panel. When I concatenate the sring with Tab Constant. I can have them in the seperate column. Although Time stamp has a small problem.

 

 Yamaeda: thanks; I used yours, I had a problem to concatenate them in the spread sheet.

 

I guess, I will use wond3rboy's solution:).

 

Cheers;

Sb

0 Kudos
Message 6 of 7
(3,438 Views)

@wond3rboy wrote:

Hi, nice work  Yamaeda. Only one thing, since he has 5 characters than "." than 3 numbers with "," in between, shouldn't his format string be:

 

%5s.%f,%f,%f

 


 

I'm pretty sure he says 5 chars than ':' but i'm making it abit more general by searching for it. Your solution works but is limited to absolutely 5 chars. 🙂

 

 

To use it in Excel you'll then wire things to "Write to spreadsheet". It'd be easiest to just bundle the doubles to an array and wire that, else you'll need to convert all to strings first, unless you make a small function yourself.

 

/Y

 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 7
(3,419 Views)