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: 

Search string and return data

Solved!
Go to solution

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
(2,803 Views)

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


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

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
(2,791 Views)

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


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

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
(2,781 Views)
It did not work here. Labview 2012.
 image.pngimage.png

 

0 Kudos
Message 6 of 17
(2,768 Views)

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

0 Kudos
Message 7 of 17
(2,760 Views)

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
(2,750 Views)

@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
(2,747 Views)

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
(2,726 Views)