LabVIEW Idea Exchange

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

Extend Array Functions to Mirror OpenG

Status: New

I've already made a post on extending File I/O operations so I figured why not make a post on my most commonly used OpenG palette, the array palette.

 

There are so many good nuggets of Array manipulation code in OpenG.  This stuff isn't perfect, and could be optimized, but the convenience of it makes sense especially when you realize there is so many things you can do with arrays.  Lets start with the Index Array, one of the most commonly used functions.

 

index.png

 

Here we see the native function allows for an N dimensional array to be indexed.  The OpenG function only supports 1D and 2D arrays.  And when using a 2D array, the OpenG function must specify both a row and a column, you can't index an entire column or row.  Both of those are very useful features of the native index, but there is something the OpenG function does, that the native doesn't, and that is index multiple indices.  You can pass in an array of indices and pull them all out in the order defined.  This can be used as a reorder function that takes an array and scrambles it the way you like.  Adding this feature is already on the idea exchange.

 

Delete.png

 

Again when it comes to polymorphism the native function beats OpenG.  The native delete supports deleting from N dimensions where OpenG is just 1D or 2D.  But OpenG allows for deleting multiple indices from an array, and if it is a 2D array you can specify if you want to delete rows or columns.  This would be a nice addition to the native function.

 

cond index.png

 

A conditional auto index function doesn't exist natively in LabVIEW.  You can perform a similar function with the conditional auto index tunnel on a for loop but having a single function would be useful.  This idea is on the exchange in multiple places, Link 1, Link 2.

 

Remove filter.png

Ever need to remove duplicates from an array?  Or remove all zeros or NaNs from an array?  These two functions do just that and on the forums all the time are requests for functions like this with no direct replacement on the native palette.  A nice feature of the remove and filter are they output the indices that were removed.  Combined with the fact that the delete, and index accept multiple indices make these very useful.  Also the items to filter for the filter can be a scalar or array which is nice.

 

sort.png

Ever want to sort an array and know how it was sorted?  This OpenG function can do that along with specifying what order, ascending or descending to use.  The OpenG sort also supports 2D arrays where you can specify if you want to sort on rows, or on columns.

12 Comments
Hooovahh
Proven Zealot

Crap I forgot one and can't edit my post.

 

search.png

The OpenG search has the added feature of returning all of the matching items, and not just the index of the first match in a search.

X.
Trusted Enthusiast
Trusted Enthusiast

This would be a perfect starting point for an update of the OpenG library with XNodes...or macros.

Hooovahh
Proven Zealot

Already done

 

https://lavag.org/files/file/169-openg-array-xnodes/

 

Of course that code is a bit dated, and several features of LabVIEW have came out since then that could make those array functions even better.  But what's even better than having to support XNodes (an unsupported technology outside of NI) is to have NI implement them in LabVIEW naively.

pawhan11
Active Participant
JÞB
Knight of NI

Hoove,  I like it!  Surprisingly, I'd rather keep it on the Open G TK.


"Should be" isn't "Is" -Jay
X.
Trusted Enthusiast
Trusted Enthusiast

The problem with the goddam toolkits is that you have to reinstall them on each machine and for every version you are installing. It gets rapidly tedious... I vote for integration.

Intaris
Proven Zealot

+1 for Integration

JÞB
Knight of NI

I completely agree that Integration of those TKs and other things are an important part of MyLabVIEW

 

Still, there are some things that extensions should do that the language does not do.  +1 for MyLabVIEW


"Should be" isn't "Is" -Jay
X.
Trusted Enthusiast
Trusted Enthusiast

Of note is that the Sort Array function of OpenG is limited to numerics and strings/paths. No cluster version exists, which is different from the native sort function, which will handle clusters of numerics nicely.

The LAVA XNode version by gb119 does. 

ReneW
Member

I don't use OpenG. Therefore I think that NI should improve the array functions. Especially the sort array function should be improved. Sometimes I had to sort 2D-Arrays or more often arrays of clusters. In my opinion it should be possible to sort these arrays in LV without workarounds. It should be possible to select the column or the cluster item to sort the array.