Showing results for 
Search instead for 
Did you mean: 

Two instances of quirky behavior: array size of empty array and tab control freeze

LV 7.1
Array size of empty array. Adding empty arrays to an array of higher dimension produces a fantom array of non-zero size.
Tab control freeze. An event structure with checked 'lock front panel until the event case completes' option permanently freezes the front panel in certain special circumstances.
Message 1 of 10

The array thing may be a problem in the way the array size primitive interpets the array representation and I think this is a major bug (note that the number is an "extra dimension"). Someone really should check that in 8.

The tab thing doesn't always happen (although it does happen most of the times). In any case, I don't like the concept of checking on events only when a tab page is visible - I prefer having a single event structure for a loop and handle whatever needed logic inside. Obviously, when you do it like that it never gets stuck.

Try to take over the world!
0 Kudos
Message 3 of 10
1: This is normal. I think having e.g. a 0 x 10 2D array can make sense and can be useful.
2. I don't see any lockups when operated as instructed using LabVIEW 8.0. Maybe it is a bug that got fixed. Smiley Happy
Still, case 2 is poor program design because you have multiple parallel event structures in the same loop. This should be avoided if possible. You could place all current event cases in a single event structure and not even connect the tab terminal. Or you could have a case linked to the tab terminal inside the single timeout case if the timeout operations need to be different and dependent on tab state. If the timeout is empty, you can even leave it out.

LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 4 of 10

Alten, I see we're going to have a major race condition here. Smiley Very Happy

Anyway, after seeing that example I decided not to post my own, but here it is anyway. Tell me if you still think this makes sense.

Try to take over the world!
0 Kudos
Message 5 of 10

@tst wrote:

 Tell me if you still think this makes sense.

Whew, let me look at this tonight after I activate the 4D module in my brain. Smiley Wink
(I think it makes sense, though Smiley Surprised) Generally I look at the product of the dimensions array to determine if an array is empty. You can initialize a multidimensional array with some dimensions at zero and it is reproduced nicely in the array size output. Also the "Empty array" tool correctly identifies it as empty, even if some dimensions are nonzero.

Message Edited by altenbach on 03-15-200612:42 PM

LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 6 of 10
Look at this VI. The result is different if you initialize the 2D array with more or less empty columns than the appended 1D array.
Indeed for LabVIEW  a 3x0 array is somehow different than a 4x0 or 0x3 array and it  is consistent in its way to manipulate them.
Of course one must be aware of this behavior as empty arrays are not equally empty. Having three empty boxes is not the same as having 2 empty boxes.
I vote not a bug.

Message Edité par JeanPierre le 03-15-2006 04:00 PM

LabVIEW, C'est LabVIEW

Message 7 of 10
OK, how about this - I took the arrays from my previous example and changed the number of dimensions on the top left array from 3 to 4 and then I saved the VI. When loading it again it still shows an extra dimension with 2 elements. The bottom array, on the other hand, does show only the 4 empty dimensions (it was resized from a 5D array, BTW).

Try to take over the world!
0 Kudos
Message 8 of 10
OK, I only got around to actually examining it now and it's obvious that the difference comes from the concatenation option which is automatically set when "down shifting", but not when "up shifting". I still don't understand where these 2 "elements" are and why they are created, though.

Try to take over the world!
0 Kudos
Message 9 of 10

I got around to it again and now I do understand why the 2 empty elements are created - these are the 2 arrays which were put one "behind" the other to create the extra dimension, so yes, apparently no bugs. I hereby offer an official apology and promise to attempt not to use the B word unless I'm concentrated enough to actually really examine it.

I guess multiple dimensions is not really my thing. Maybe NI should add an Alternate Realities option instead? Smiley Very Happy That would mean that in at least one reality LV would figure out exactly what you're trying to do even if you're not doing it right and do it for you. Then, all LV R&D need to do is find a way to detect that alternate reality and reproduce it. I'm sure that's much easier than chasing all those bugs. Smiley Very Happy

Try to take over the world!
0 Kudos
Message 10 of 10