LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Show Last Element of array differs for horizontal and vertical arrays

The pop-up menu item Show Last Element behaves differently for 1D arrays displayed horizontally or vertically with multiple elements visible.

 

The horizontal display shows the last k elements where k is the number of elements visible when k < N. The vertical display only shows the last element and k-1 empty elements.

 

Last Element.png

 

See attached VI for a simple example. The VI was written in LV 2012 and saved back to LV 8, but not tested in any earlier version.

 

The LV Help is not very helpful. Under Adding Elements to Arrays it says: "Right-click the index display and select Advanced»Show Last Element from the shortcut menu. The index display changes to the index value of the last element in the array."

 

This is the behavior of the vertical display but not the horizontal display.

 

Generally the horizontal display behavior is what I want, although for the Add Elements to Array process the vertical behavior may be better.

 

Is this a bug (inconsistent behavior)? A feature? An unintended consequence of something else?

 

Lynn

0 Kudos
Message 1 of 15
(5,222 Views)

Hi 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 2 of 15
(5,213 Views)

@johnsold wrote:

Is this a bug (inconsistent behavior)? A feature? An unintended consequence of something else?


I agree, this looks inconsistent.


@Ranjeet_Singh wrote:
Make the index of both the array 0 then run your program. 

 


What are you trying to say here? You are just repeating the instruction #1 on the front panel of the posted VI, then repeating what the image above already shows.

0 Kudos
Message 3 of 15
(5,164 Views)

@altenbach wrote:

@johnsold wrote:

Is this a bug (inconsistent behavior)? A feature? An unintended consequence of something else?


I agree, this looks inconsistent.


@Ranjeet_Singh wrote:
Make the index of both the array 0 then run your program. 

 


What are you trying to say here? You are just repeating the instruction #1 on the front panel of the posted VI, then repeating what the image above already shows.


I would call it expected behavior.  After all LabVIEW arrays are (Row, Col.....) you see the last element in the last displayed row.  This should help keep the dimension order cleanly in your mind even if you display a row vertically.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 15
(5,158 Views)

I would also call this inconsistent behavior.  The last displayed row should contain the last row in the array.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 15
(5,145 Views)

Two to one for inconsistent behavior.

 

I think I understand what your are saying, Jeff, but I thought that unlike MATLAB, LV considers 1D arrays independent of direction of display. Under that interpretation it seems like the same values shoud be displayed regardless of direction.

 

Lynn

0 Kudos
Message 6 of 15
(5,134 Views)

@johnsold wrote:

Two to one for inconsistent behavior.

 

I think I understand what your are saying, Jeff, but I thought that unlike MATLAB, LV considers 1D arrays independent of direction of display. Under that interpretation it seems like the same values shoud be displayed regardless of direction.

 

Lynn


well, not exactly.  What happens when you add dimention to a 1D array or remove dim from a 2D?  a 1D array is a row.  Implementing a transpose with a vertical row display is problematic. And arrays must be rectangular since they are flat in memory.   That being said.  I wouldn't cry if the behavior changed.


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 15
(5,121 Views)

I will not call this inconsistent behavior because it is consistent.  It uses the same formula in either case:  Last Index = Length - #cols.

 

While consistent, I do consider it wrong.  The formula I would choose is Last Index = Length - 1, for all dimensions.  Show Last Element should IMO put the last element in the upper left position.  I understand the appeal of the horizontal behavior, but I do not really like the idea of counting the number of visible rows and columns to determine the index of the last element.  Either way, it should be Length-1 or Length - Max(#rows,#cols), but not Length-#col

 

What I would like is the optional ability to disable in addition to graying out the out-of-bound controls.

0 Kudos
Message 8 of 15
(5,115 Views)

If you want the index of the last element, use Array Size - 1.

 

Often when I use Show Last Element, I want to see the values of the last element and several preceeding it.  I would prefer the lower right position as the one containing the last element.  If I only want to see one element at a time, I will set the display to show only one element. Of course that case has no inconsistency.

 

Lynn

0 Kudos
Message 9 of 15
(5,110 Views)

Hello all,

 

I filed CAR 389834 on this behavior. It is inconsistent behavior between the vertical and horizontal display. Since it is a 1D array, it should be only a visual difference and it should not be row vs column. I linked this thread to the CAR, but can you give me a bit of context of how this behavior affects your application? It seems like a cosmetic issue with low impact, so if it is impacting you more severely, I would be interested to hear about it.

 

As always, thank you for reporting these issues!

 

Jeff Peacock 

 

Product Support Engineer | LabVIEW R&D | National Instruments 

Message 10 of 15
(5,094 Views)