LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Vb-difficult in Labview search 2d array elements

Hi all,
I have a "simple" question, I'd like to control in a 2d array if an elemente
and the following are both equal to a given value(e.g. FF (hex value))
does anyone of you know a simple way to do this?

Thank you very much .
0 Kudos
Message 1 of 10
(3,615 Views)
I'm not sure exactly what you mean, but the comparison function in LV is polymorphic meaning that you can compare an array of numbers to a single value and get an array of boolean values.

Can you explain in a little more detail what you are wanting to do?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 10
(3,615 Views)
Here's a simple example that searches for a specified repeated value in a 2D array.
0 Kudos
Message 3 of 10
(3,615 Views)
Here's another simple example that doesn't look for any given value but just if two adjacent column values are equal. If you want to look to see if 2 row values are equal, all you need to do is insert a Transpose 2D Array function between the 2D arry and the input to the outer for loop.
0 Kudos
Message 4 of 10
(3,615 Views)
Slick use of Index Array to pull out two elements! I haven't seen that in the LabView Help. Learn something new every day (at least on good days)!
0 Kudos
Message 5 of 10
(3,615 Views)
before all, thanks very much for the answer,

I have a 2d array and I need to know the indexes of whom are representative
of the occurrence of double equals following values: I'll try to explain
with an example:

If the number that I'm searching in "double following occurrence" is "1"
and the array is
MYARR
6 5 8 9 5 9 8 4
1 1 4 2 3 5 6 8
6 5 8 9 5 4 1 2
4 8 7 9 6 2 1 4

as you can see on the 2nd row on the 1st and 2nd columns there two numbers
"1" I need to get (2;1) that are the indexes of the double 1 in myarr, I
need to Know all the indexes where they occurs.

Please help me
0 Kudos
Message 6 of 10
(3,615 Views)
See my example and Dennis's example. Just remember that array indexes start at 0: so the repeated 1's are in row 1, columns 0 and 1.
0 Kudos
Message 7 of 10
(3,615 Views)
"Al S" ha scritto nel messaggio
news:50650000000500000011D60000-1042324653000@exchange.ni.com...
> See my example and Dennis's example. Just remember that array indexes
> start at 0: so the repeated 1's are in row 1, columns 0 and 1.

Only a question: where can I find yours and dennis's example?
thanks
0 Kudos
Message 8 of 10
(3,615 Views)
Attached is a VI to do the search that you requested.

A key aspect of this VI is that it does all the comparisons for each row in parallel by creating two copies of each row. One copy has the last element removed, the other has the first element removed. Comparing the two arrays produces an array of boolean flags that indicate the equality of adjacent values in the row.

Next, if all the bits in a row are off (OR of all the bits = false) the code does nothing. If at least one of the bits is true, it searches through the boolean array and inserts a index record into a results array for each bit it finds set.

Finally, the code increments all index values by one to produce the 1-based indexing requested.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 9 of 10
(3,615 Views)
Some news readers don't display post's with atttachments. Go to http://exchange.ni.com/, create a login and go to the LabVIEW discussion group. You'll find our examples, a search tool, and links to all kinds of other information on LabVIEW.
0 Kudos
Message 10 of 10
(3,615 Views)