cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Search string and return data

Solved!
Go to solution
Highlighted

Search string and return data

Hi, I'm new to labview. I have a string (Data1: A, Data2: B, Data3:C.......), I need to go through this string to fetch the data, regardless of the order. Example: look up Data2 and return only B. But I need to do this for a set of Data1 or Data2 and etc, my string will contain a lot of data.

0 Kudos
Message 1 of 17
(146 Views)

Re: Search string and return data

Hi Rafael,

 

what have you tried and where are you stuck?

 

What about SearchString function? What about a loop to repeat the search?

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 2 of 17
(141 Views)

Re: Search string and return data

Actually I tried several options that I found in the forum but none served me, my idea was this a search and a loop and with that go through the string and fetch the data that I need.

0 Kudos
Message 3 of 17
(134 Views)

Re: Search string and return data

Hi Rafael,

 

my idea was this a search and a loop and with that go through the string and fetch the data that I need.

Then you should create a VI following that idea of yours.

Come back when you have specific questions!

(Like that "what is your problem and where are you stuck?")

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 4 of 17
(126 Views)

Re: Search string and return data

If all your data is in one line (no new-line constant), you can transform string into array.
Then you can search throw 1st column and take correct element from 2nd one.

str.pngstr2.PNG

Message 5 of 17
(124 Views)

Re: Search string and return data

It did not work here. Labview 2012.
 image.pngimage.png

 

0 Kudos
Message 6 of 17
(111 Views)

Re: Search string and return data

Of Course you can't place strings into "double" numbers

0 Kudos
Message 7 of 17
(103 Views)

Re: Search string and return data

Perfect, now it worked. Now I need to scan this array and fetch only the data I need. Example: fetch the data B from the variable Data2.

0 Kudos
Message 8 of 17
(93 Views)

Re: Search string and return data


@rafael.assis16 wrote:

Now I need to scan this array and fetch only the data I need.


Yes, you should scan array for "name" and select correct element from second col

0 Kudos
Message 9 of 17
(90 Views)

Re: Search string and return data

Could you give me an idea how I can get the row and column and just show the data I need? Example: Show B of Dados2 (row1, column0) in a variable of type string.

 

image.pngimage.png

0 Kudos
Message 10 of 17
(69 Views)