LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
altenbach

Allow boolean arrays as input for "Array Min & Max"

Status: New

The Array Max & Min function is quite versatile, but for some reason it does not accept boolean arrays.

 

This restriction make no sense at all. Since we can easily sort boolean arrays, this function should work too!

 

It would come in handy for example if looking for the position of a single TRUE in a 2D array (search only works for 1D arrays!). Array min & max would simply return the index pair of the first TRUE found. As a workaround, we currently need to insert a "boolean to 0,1" to get the same effect. This seems unecessary.

18 Comments
AristosQueue (NI)
NI Employee (retired)

Altenbach, before we argue about the Boolean array, let's talk about the refnum case first:

 

BrokenMinMax.png

 

The refnums are not considered to be sortable data types. They are not generally meant to be usable as integers. Most operations that are allowed on integers are not allowed on refnums. You can use Equals on a refnum, but not Greater Than or Less Than. However, we want to be able to sort a cluster that has real data and keep the refnum associated with that real data, so a cluster of refnums is sortable.

 

I don't think this is a tangent from the main idea. I think that there's more room for discussion with the refnums than with the booleans, and whatever we conclude about the refnums might apply back to the simpler case of the booleans.

 

So... what does everyone think of LV's rules for the refnum arrays?

tst
Knight of NI Knight of NI
Knight of NI

The broken wires for the refnums look reasonable. I don't think I would ever consider one refnum "bigger" than the other.


___________________
Try to take over the world!
altenbach
Knight of NI

(Adding to an old idea that did not get much attention but is dear to my heart.)

 

Why is there such a deep chasm between numerics and booleans? It does not need to be!

A very related idea is this one, allowing math with booleans and numerics.

Manzolli
Active Participant

LabVIEW has a function to convert a Boolean to 0 or 1. This is why it's different from refnums. Kudos!

André Manzolli

Mechanical Engineer
Certified LabVIEW Developer - CLD
LabVIEW Champion
Curitiba - PR - Brazil
md12g12
Member

To revive this question, I am trying to do exactly the same thing as altenbach. I have very little labview experience so trying to build a workaround is long and tedious. There should be an easier way to find a change within an N-dimension array and return its position. For a Boolean array the min/max function in a value change loop would be great but for no good reason it doesnt work.

 

For context I am trying to create a control where if I click an LED in an array of LED's I get a position readout to move a stage. (And want to use LED's so I can see which positions have been tested or not)

crossrulz
Knight of NI

Search 1D Array will do what you want.


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
altenbach
Knight of NI

Search 1D Array will do what you want.

 

They were talking about N-dimensional arrays. we don't have a Search ND array. in the stock palettes.

 

(Just going over some old ideas. I know this idea did not get much attention in a while)

altenbach
Knight of NI

Also note that even the plain Max&Min accepts Booleans!

 

altenbach_0-1660580744622.png

 

Another use for the "Array Max&Min" function is to determine if all elements are the same, even if we don't care abut the actual value. (see here, for example ).