User | Kudos |
---|---|
6 | |
5 | |
2 | |
2 | |
2 |
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.
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.
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.
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.
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.
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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.