LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help finding strings within a string

Solved!
Go to solution

Hi i'm having trouble trying to figure out how to do this. Im using labview with bluetooth modules. When you call another module you need the address of that module. To find the address you tell your module to inquiry. When the inquiry comes back it is in this format:

 

INQUIRY_PARTIAL 00:07:80:93:54:97 001f00
INQUIRY_PARTIAL 00:23:d6:a9:0a:b0 5a020c
INQUIRY 2
INQUIRY 00:07:80:93:54:97 001f00
INQUIRY 00:23:d6:a9:0a:b0 5a020c

 

I'm trying to pull out every istance of the address in the format :

 00:07:80:93:54:97

This inquiry found 2 module with 2 different address. I just want to pull out every address and display just the addresses in a string. So my indicator should display:

 

00:07:80:93:54:97

00:23:d6:a9:0a:b0

0 Kudos
Message 1 of 10
(3,942 Views)
Post what you have did so far.
Message 2 of 10
(3,920 Views)
Solution
Accepted by topic author VeritasAequitas

Try something like this:

 

 

 

(Of course you can get more fancy for the address matching, because only 0..f are legal elements, but this should probably work.) 

Message Edited by altenbach on 04-19-2010 09:51 PM
Download All
Message 3 of 10
(3,914 Views)

Thank you for the replies. I actually did figure it out using this method

 BDADDRSS.jpg

0 Kudos
Message 4 of 10
(3,906 Views)

ajh305 wrote:

I actually did figure it out using this method


 

 
 That does not look right. Where's that string coming from that you use for the length? Can you show all relevant code?
0 Kudos
Message 5 of 10
(3,899 Views)
Here's a different implementation using Spreadsheet String to Array and OpenG's Remove Duplicates from 1D Array.

Example_VI.png
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 6 of 10
(3,872 Views)

jcarmody wrote:
Here's a different implementation using Spreadsheet String to Array and OpenG's Remove Duplicates from 1D Array.

 

 
It's not exactly the same and less general, because it assumes that there is never more than one address per line.
In this particular case, this might be a safe assumption. 😉
0 Kudos
Message 7 of 10
(3,851 Views)

Here is some of the recieved information that the program I wrote sifts through:


WRAP THOR AI (3.0.0 build 165)
Copyright (c) 2003-2008 Bluegiga Technologies Inc.

Was Recieved 
4/20/2010
3:09:33 PM

READY.

Was Recieved 
4/20/2010
3:09:34 PM

inquiry 5

Was Recieved 
4/20/2010
3:09:38 PM

INQUIRY_PARTIAL c8:7e:75:6d:75:6b 5a0204

Was Recieved 
4/20/2010
3:09:39 PM

INQUIRY_PARTIAL 00:07:80:93:54:97 001f00

Was Recieved 
4/20/2010
3:09:39 PM

INQUIRY 2
INQUIRY c8:7e:75:6d:75:6b 5a0204
INQUIRY 00:07:80:93:54:97 001f00

Was Recieved 
4/20/2010
3:09:44 PM

call 00:07:80:93:54:97  1 rfcomm
CALL 0

Was Recieved 
4/20/2010
3:09:47 PM

CONNECT 0 RFCOMM 1

Was Recieved 
4/20/2010
3:09:47 PM

HELLO
Was Transmitted 
4/20/2010
3:09:59 PM
.  

When the inquiry button is depressed the program sifts though the code and writes the addresses found to a menu ring.

BDADDRSS.jpgfront.jpg

0 Kudos
Message 8 of 10
(3,833 Views)

Thanks! A VI would be much more useful that an oversize picture of truncated code. 😞

 

As I said before, your code makes no sense. The while loop runs once per character in the string, meaning the array going to the "strings()" property will potentially have a huge number of mostly empty elements. Do you really need to do that over and over again with every iteration of the big loop? How often does the string actually change?

 

If you want to reinit something on first run, place that inside the startup frame to the left instead of the main loop. No case needed.

0 Kudos
Message 9 of 10
(3,826 Views)
Here is the complete program. The length of the list wasnt really a concern all that mattered to me was getting the relevent information into the list.
0 Kudos
Message 10 of 10
(3,822 Views)