LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple search 1D array elements

Just wondering, from a single array am I able to search for different elements?

 

search2times.png

0 Kudos
Message 1 of 11
(5,141 Views)

There are some "hidden" VIs in your <vi.lib> folder.  Try this one:

 

vi.lib\AdvancedString\Match 1D String Array.vi

 

Basically it combines "Search 1D array" from the array palette with the "Match Pattern" VI from the string palette.

 

So you can search for [5A][5A] or whatever pattern fulfills your searching needs.

Message 2 of 11
(5,103 Views)

Hi Kyle,

 

I can't seem to find where Advanced String folder is located. When I do a search, I can't find Match 1d String Array as well. Where is this located?

 

Thanks,

Andrea

0 Kudos
Message 3 of 11
(5,054 Views)

If you look in VIPM (VI Package Manager), you will find a package called "Hidden Gems".  Install that package and you will see a new item in your palette exposing these functions that were mentioned.

 

For more information: Hidden Gems in vi.lib


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 11
(5,048 Views)

I'm fairly certain that you don't actually need to install the "hidden gems" addon.  I checked 2 PCs with LV 2015 and LV 2011 installed on them, and both had the file mentioned in vi.lib already.  Neither had the addon installed via the package manager.

 

To clarify:

This VI is a National Instruments VI and is included with your LabVIEW install (unless you have a really old version...).

This VI is not in your palettes by default, which is probably why you can't find it.

 

Depending on your OS and installed version the actual location may be different, but for example you might find it here:

 

C:\Program Files (x86)\National Instruments\LabVIEW 2015\vi.lib\AdvancedString\Match 1D String Array.vi

 

 

0 Kudos
Message 5 of 11
(5,042 Views)

@AndreaD wrote:

Just wondering, from a single array am I able to search for different elements?


Define what you mean by "different elements". It is not clear to me from the picture.

  • Do you want to find one or the other (whatever comes first).
  • Do you want to find the first instance of each?
  • Does each occur multiple times and you want to find all of the locations?
  • Does one of the always come first? (search for that one, then starting from the found index search for the second one)

Even without the mentioned subVI, it seem trivial to just autoindex over an array of search elements and do a "search array" on each. It can probably even be parallelized.

0 Kudos
Message 6 of 11
(5,038 Views)

Definition of "different element" ... Just because 5A and A5 are in different orders, they're associated with different packets of data (not my choice of naming data packets, since it's so close, but it's from another engineer)

 

Somehow when reading the data, it reads 5A but not A5 ... Is it supposed to? Perhaps there just isn't the A5 data coming out?

 

Thanks,

Andrea

0 Kudos
Message 7 of 11
(5,026 Views)

@AndreaD wrote:

 

Somehow when reading the data, it reads 5A but not A5 ... Is it supposed to?


Could be a byte order thing. What does the string represent?

0 Kudos
Message 8 of 11
(5,020 Views)

Those are values to two different packets of data (again, not my choice of packet definition, they're both way too close!!)

0 Kudos
Message 9 of 11
(5,017 Views)

C:\Program Files (x86)\National Instruments\LabVIEW 2015\vi.lib\AdvancedString

Here you can find the VI

Message 10 of 11
(3,036 Views)