From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Idea Exchange

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

Include Set Operations (Union, Intersection, etc.)

Status: Completed

Available in LabVIEW 2019 and later with VIs and functions in the Collections > Set palette.

LabVIEW should ship with a Set Operations palette item, including the common operations such as Union, Intersection, Complement, and Cartesian Product, as well as more advanced operations that I don't know about. These operations would act on 1D arrays of almost anything. Floating point numbers and those would have to have some kind of "error in value" input that defaults to the machine epsilon or equality checking. Output would be a 1D array on the input datatype with the values, and perhaps an output for matched indices.

 

Yes, these are quite easy to make yourself (loop+search), but I think that it would be beneficial for the community for NI to provide it. The VIs found at http://zone.ni.com/devzone/cda/epd/p/id/3929  are... Interesting, to say the least. NI might be able to provide better performance, too.

4 Comments
X.
Trusted Enthusiast
Trusted Enthusiast

You could also use the OpenG VIs (which are polymorphic):

 

ScreenHunter_001.jpg

ScreenHunter_002.jpg

 

ScreenHunter_003.jpg

 

 

as in:

 

Simple Set Operations.png

 

We are missing the cartesian product, but I am not sure what you may want to use it for PRACTICALLY?

dthor
Active Participant

I do use those functions (gotta love OpenG), but not all developers do. Also, and this is a minor inconvienence, after peforming the operation you need to coerce back to the original data type.

 

Other set operations can be done with OpenG, but require more code. For example, A ⊆ B ? (is A a subset of B?) is pretty easy to do, but Power Set(A) will be more complicated.

 

In addition, the well-defined sets (Primes, Complex, the Null set, et cetera) could be added as constants.

 

I just think it would be useful to have dedicated set theory operations in LabVIEW.

X.
Trusted Enthusiast
Trusted Enthusiast

I guess you're right. I am just not using set operations myself (not that I can remember at least).

Darren
Proven Zealot
Status changed to: Completed

Available in LabVIEW 2019 and later with VIs and functions in the Collections > Set palette.