12-08-2016 05:25 PM - edited 12-08-2016 05:35 PM
An intriguing example shows how to get the dimension sizes of a 2D array was apparenty posted long ago here. (Publish date is in 2013, but there is a comment from 2006, so who knows how old this is. Maybe in LabVIEW 1.0, getting the size of a 2D array was more difficult than today?)
So, what thought process could have possibly led to this code? Mind boggling!
(Natural is ""array size" but there is also "Matrix size" that could be used).
12-09-2016 01:19 PM - edited 12-09-2016 01:21 PM
Wow. That takes a special kind of twisted thinking to come up with that! And they set up the connector panel to have an input at the top and the outputs at the bottom.
Looks like it was saved with LV 7.0, so that is no older than about 2003. (Well I guess it could be older and they upconverted it to 7.0 sometime around 2003 or later.)
I see it links to an NI Example program page that implies that it is somehow NI sanctioned. I don't know how easy it is to discover that page, but pure garbage like that should be thrown away.
12-09-2016 02:00 PM
I'm not entirely sure that I understand that code.
12-09-2016 03:35 PM
@JÞB wrote:
I'm not entirely sure that I understand that code.
Well, the autoindexing of the plain and transposed array is used to get a column or row, respectively, which then allows getting the row and column 1D size before the loop stops after one iteration. A TRUE wired to the termination would have worked equally well and would have protected from the possible size wrapping of the sum to a negative value.
12-10-2016 05:31 AM
I am revising some of my older projects, and I have found this... actually I did not change that much, I am still very vulnerable to end up with Rube Goldbergs 🙂
12-12-2016 11:00 AM
You probably want the Ceil(Index of threshhold) for Start and Floor(Index of threshhold) for end to be an exact dup of the code above
12-12-2016 11:02 AM
@JÞB wrote:
You probably want the Ceil(Index of threshhold) for Start and Floor(Index of threshhold) for end to be an exact dup of the code above
Yes, thanks.
12-23-2016 09:04 AM
I found this code in a review, the idea of the original code was to build the complement of two from a number of bits less than 16. The programmer did it in a really hard and not modular way. Im not shure if it works for every value...
Probably there is even a more simpler solution...
12-24-2016 11:43 AM
I don't think the two code fragments are equivalent, because the lower code depends on a size input, while the upper does not.
01-12-2017 08:19 AM
There's a constant size 14 in the upper one.
/Y