LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do you get positional information from boolean arrays

Hi,

 

I am constructing a 5x3 boolean array as an input.  I add an array indicator and when I run the program, when i push a button in the array input the corresponding light goes on,on the indicator.

 

So now, I am trying to get the x,y coordinates of the button pushed so I can use this information in a program.

 

I cant seem to get the x,y coordinates out.....HELP!

 

 

Brian

0 Kudos
Message 1 of 31
(4,319 Views)

Hi Brian,

 

If you use an event structure, a mouse down or mouse up event on the array control will return the coordinates.



CLA
www.dvel.se
0 Kudos
Message 2 of 31
(4,287 Views)

Using an event structure, you can get the "old value" and the "new value".  Use a Not Equal and then do a search for the TRUE.


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 3 of 31
(4,274 Views)

Thanks, but I don't understand the mouse up/down part...

0 Kudos
Message 4 of 31
(4,175 Views)

@Metalhead wrote:

Thanks, but I don't understand the mouse up/down part...


I recommend using the Value Change event.  That event gives you the "old" and "new" value of the array.  Just do a comparison and find the first element that is different.


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
0 Kudos
Message 5 of 31
(4,171 Views)

@crossrulz wrote:
I recommend using the Value Change event.  That event gives you the "old" and "new" value of the array.  Just do a comparison and find the first element that is different.

 If course if people would actually vote for my idea here, things could get simplified. You could simply do a "array min&max" on the "not equal" array. (see the idea discussion for details).

 

Until then we could use this (Also works for higher dimensions, 3D, 4D, etc.!):

 

 

 

(Other methods for finding the true element of a 2D boolean array requires reshaping to a 1D array, for loops, or other flaming hoops)

 

 

0 Kudos
Message 6 of 31
(4,160 Views)

I like Altenbach's answer, that's a pretty slick bit of code, but I"m trying to figure out what you are working on that needs this. Is this just an assignment in a class? What are some real life uses for this?

Glad to answer questions. Thanks for any KUDOS or marked solutions 😉
0 Kudos
Message 7 of 31
(4,140 Views)

To be clear, are you talking about xy coordinates on your screen, or are you talking about xy position in your array?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 31
(4,124 Views)

Or the array indexes (indices) of the clicked boolean?

 

Lynn

0 Kudos
Message 9 of 31
(4,109 Views)

...So now, I am trying to get the x,y coordinates of the button pushed so I can use this information in a program.


 

 

 

I think it is quite clear that he meant indices. i.e. the information quantized to the buttons. It is probably less intersting to know on which pixel a certain button was clicked. 😄

0 Kudos
Message 10 of 31
(4,104 Views)