LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I use the Match Pattern Function to exclude only 0.000?

Hi,
 
I'm trying to use the mattch pattern function to find the first string in a table thats is >0. My table looks like:

1,0.000000,0.000 %2007/01/13 00:16:19 196281

1,0.000000,0.000 %2007/01/13 00:16:22 196282

1,0.831262,0.000 %2007/01/13 00:17:20 196375

2,0.811154,0.000 %2007/01/13 00:17:20 196375

If I us the paremeter "1,[~0]" It doesn't find the line 1,0.831262,0.000... which is the one that I want. I also tried :1,[0-9].+[~0] and that didn't work either. the problem is that the first digit after to 1, isn't allways going to go from 0 to 0.0 sometimes it might go from 0 to 2.??.

 

Thanks for the help

Matt

 
0 Kudos
Message 1 of 8
(3,178 Views)

It's rude... but works.

 

Vicen

WinXP / LV7.1

0 Kudos
Message 2 of 8
(3,172 Views)

@vicens wrote:

It's rude... but works.

Vicen


Thanks Vicen!

That got me started going down the right road and now it's working they way it should Thanks!!

(FYI I saw that said you were using 7.0, well what you sent me didn't work until I removed the search and replace function... Maybe thats something new with 8.0 or 8.2. But if you just send the string direcetlly into the converter you used with the decemical point it works fine)

Thanks again for the help!!

Matt

0 Kudos
Message 3 of 8
(3,159 Views)

"Matt361" <x@no.email> wrote in message news:1168870209277-463734@exchange.ni.com...
Hi,
&nbsp;
I'm trying to use the mattch pattern function to find the first string in a table thats is &gt;0. My table looks like:


1,0.000000,0.000 %2007/01/13 00:16:19 196281
1,0.000000,0.000 %2007/01/13 00:16:22 196282
1,0.831262,0.000 %2007/01/13 00:17:20 196375
2,0.811154,0.000 %2007/01/13 00:17:20 196375
If I us the paremeter "1,[~0]" It doesn't find the line 1,0.831262,0.000... which is the one that I want. I also tried :1,[0-9].+[~0] and that didn't work either. the problem is that the first digit after to 1, isn't allways going to go from 0 to 0.0 sometimes it might go from 0 to 2.??.
&nbsp;
Thanks for the help
Matt
&nbsp;


Hi,


1,[~0] matches a "1" a "," and then any character that is not "0".


1,[0-9].+[~0] matches a "1" a "," and then any character that is "0-9", any number of anything!! (1 or more) and then anything that is not "0". Note that you have to escape a . to match a ".". Like this "\.".


There is no way to check if there is anything other then a "0" in the match, from within the match pattern function. So I think you won't be able to find a pattern that does the trick.


Why not use a whileloop to find the first item? Or use the Spreadsheet String To Array, and then compare the desired row or column with the string "0.000000"? (Or replace all ,0.000000, by a string like ",NULL,", then match the pattern?)


In LabVIEW 8 there is a new Match Regular Expression function. Haven't tried it, but it should be much more powerfull then the Match Pattern function. But also much more complex.


Regards,


Wiebe.


0 Kudos
Message 4 of 8
(3,153 Views)

I'm in a european computer (decimals are , not .).

I don't know...

0 Kudos
Message 5 of 8
(3,153 Views)


@vicens wrote:

I'm in a european computer (decimals are , not .).


Oh... ic, I didn't know that european computers used commas instead of decimal points. I could see were that could become a problem in a American bassed program such as labview. I'll have to remember that!

Thanks again for the help

Matt

0 Kudos
Message 6 of 8
(3,140 Views)

"vicens" <x@no.email> wrote in message news:1168872012473-463764@exchange.ni.com...
It's rude... but works.
&nbsp;
Vicen
WinXP / LV7.1



zero.vi:
http://forums.ni.com/attachments/ni/170/224158/1/zero.vi



If you use the Match pattern with only one character, you can gain a lot of speed by using the Split String function...


Regards,


Wiebe.
0 Kudos
Message 7 of 8
(3,137 Views)



If you use the Match pattern with only one character, you can gain a lot of speed by using the Split String function...


Thats Wiebe,

I didn't know about the Split String function.

I ended using a while loop that checks to see if the number after the first constant is not equal to zero. If true it stops and returns the remaining values in the string. If it is equal to zero it repeats the search again with the remaining values (I used a shift register wired to the after substring on my Match pattern function)

Thanks for the help everyone!

Matt


 

0 Kudos
Message 8 of 8
(3,131 Views)