Jump to content

Best way to search muti-line string ?


i2dx

Recommended Posts

I did do a search but didn't find what I need.

I have a multi-line string and need to search for a small string in each line and if that line contains it i want to pull that entire line into another string. So for example:

My mutil-line string looks like this

01 02 11 22 22 22

01 02 00 22 22 22

01 02 10 22 22 22

01 02 11 22 22 22

01 02 10 22 22 22

01 02 11 22 22 22

01 02 00 22 22 22

And my search string is:

"10 22"

So my output would be

01 02 10 22 22 22

01 02 10 22 22 22

Maybe transfer the multi-line string into a cluster of strings would be a better idea ?

Link to comment
I did do a search but didn't find what I need.

I have a multi-line string and need to search for a small string in each line and if that line contains it i want to pull that entire line into another string. So for example:

My mutil-line string looks like this

01 02 11 22 22 22

01 02 00 22 22 22

01 02 10 22 22 22

01 02 11 22 22 22

01 02 10 22 22 22

01 02 11 22 22 22

01 02 00 22 22 22

And my search string is:

"10 22"

So my output would be

01 02 10 22 22 22

01 02 10 22 22 22

Maybe transfer the multi-line string into a cluster of strings would be a better idea ?

Here is a solution:

post-17-1135383634.png?width=400

Download File:post-17-1135383630.vi

Happy Holidays! :beer:

PS - you will need to download and install OpenG Commander you will need the the OpenG Toolkit Array and String libraries (oglib_array and oglib_string packages) in order to run this example.

Link to comment
Thanks!

One problem though:

Installed OpenG

Selected packages

Downloaded and Installed

but then, nothing shows up in my feature palette. Nothing, no in the "users libraries", not in main, I have noticed the files are in the user.lib dir, but they don't show up.

Am i missing somthing here?

Make sure that (1) you installed the dynamicpallete package and that (2) you rebooted LabVIEW. This should fix the problem. After doing that, you will see an "OpenG" palette submenu in the Functions palette. Also, If you switch to the "Dynamic Palette View" or "2-D Dynamic Palette View" palette view you will see that the OpenG libaries appear in the applicable subpalettes.

Link to comment
I did do a search but didn't find what I need.

I have a multi-line string and need to search for a small string in each line and if that line contains it i want to pull that entire line into another string. So for example:

My mutil-line string looks like this

01 02 11 22 22 22

01 02 00 22 22 22

01 02 10 22 22 22

01 02 11 22 22 22

01 02 10 22 22 22

01 02 11 22 22 22

01 02 00 22 22 22

And my search string is:

"10 22"

So my output would be

01 02 10 22 22 22

01 02 10 22 22 22

Maybe transfer the multi-line string into a cluster of strings would be a better idea ?

You don't need the OpenG tools, it can of course be done with plain LabVIEW:

post-833-1135437137.png?width=400

Download File:post-833-1135437245.vi

-Franz

Link to comment
You don't need the OpenG tools, it can of course be done with plain LabVIEW:

post-833-1135437137.png?width=400

Download File:post-833-1135437245.vi

-Franz

Thats what I was a looking for! I wouldn't mind the OpenG ones, but....

For one I could not get the subVIs to show up in the menu. I could add them manually,

And second once I did get them installed.... That VI didn't even work for me. I copied it e-x-a-c-t, but nothing, I'm guessing that even tho the VIs said they were installed they were not working. I wonder if it has anyhing to do with me having XP x64 and the labview installed in the C:\Program Files (x86)\ dir ?

Now I just need to make it so it filters upto 10 different strings, first try didn't go so well, kept overwriting my filtered messages buffer. I can probably figure it out tho,

Thanks for all your help everyone,

Link to comment
Nevermind, I got a String Array....... it was luck though. How do you guys make a String Array ?

You create an array control or indicator and drag a string control into it. This is really quite a basic thing. You should learn this from going through tutorials (hint, hint).

Link to comment
  • 2 weeks later...

@temp409x and Jim:

i have the same problem with OpenG. I can install the Commander and download Packages, but i see nothing in my palettes.

Maybe this happens, because i have a english LabVIEW installed on a german Windows XP? where the default path to LabVIEW is not "C:\Programm Files\National Instruments\..." but "C:\Programme\National Instruments\..."

best regards,

CB

Link to comment
@temp409x and Jim:

i have the same problem with OpenG. I can install the Commander and download Packages, but i see nothing in my palettes.

Maybe this happens, because i have a english LabVIEW installed on a german Windows XP? where the default path to LabVIEW is not "C:\Programm Files\National Instruments\..." but "C:\Programme\National Instruments\..."

Mmmh, I think the path should not really matter. I'm not intimate with all aspects of OpenG tools such as Commander and Builder but the different OpenG tools and menu palettes should all use relative paths internally. Otherwise it couldn't work on non-Windows systems at all and as far as I can say (Linux) it seems to work fine.

Rolf Kalbermatter

Link to comment
@temp409x and Jim:

i have the same problem with OpenG. I can install the Commander and download Packages, but i see nothing in my palettes.

Maybe this happens, because i have a english LabVIEW installed on a german Windows XP? where the default path to LabVIEW is not "C:\Programm Files\National Instruments\..." but "C:\Programme\National Instruments\..."

best regards,

CB

Are you using LV 8? Then all the OpenG stuff appears in a single sub-pallete. If using prior to 8 you should have a full set of tools in all the appropriate locations.

Check your user.lib folder in NI/LV x.x/user.lib

If correctly installed you should see a whole bunch of OpenG tools installed there. If correctly installed, then cruise over to:

Block diagram>right-click-pallete & nail it, then -options (top right corner) and select Dynamic pallete view.

You should see the OpenG functions in each of the sub palletes. Check array functions to see if you have the OpenG array tools.

I would really urge you to download and install these tools. They are well-written, extremely useful and in general bug-free.

Neville.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.