LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scrolling table with two columns

I am trying to scroll the output of a 2D array.  I have it working but it is displayed as two scrolling string indicators. It would be nice to have the display in the form of a table. I have tried to modify what I have to output to a scrolling table but I cannot seem to get it. any suggestions would be nice, thank you 

Download All
0 Kudos
Message 1 of 7
(1,659 Views)

Why don't you just combine those two 1-D arrays into a 2-D array.

 

A table is a 2-D array of strings.

 

Other odd constructs.

1.  Using a Value Property Nodes when you could just build the strings with a shift register.

2.  Using a While Loop for a known number of iterations when you really should be using a For Loop.

3.  Using Index Array in the While Loop with the i terminal when you could just auto-index the arrays at the For Loop tunnels.

0 Kudos
Message 2 of 7
(1,633 Views)

 ravens already said, there is so much wrong with your code.

 

A few more comments:

  • Starting with en empty 2D string array in the upper shift register will never shw anything intresting because you are replacing rows that don't exist, resulting in another empty array.
  • Transposing a 2D array with every iteration is just plain silly.
  • There is a primitive to check for empty strings.
  • Are both inputs typically the same array size?
  • I don't think your property nodes make any sense.

 

Here are a few ideas.

 

0 Kudos
Message 3 of 7
(1,612 Views)

thanks for the tips after posting I did start going in the directions of just inputting  the two arrays into table as a 2D array..

Yeah, using the for loop makes more sense. 

Yes, both inputs are the same size. what I was trying to do with the property nodes is to push the data up as a new row is inserted into the table.  Not sure if this is the best method but I got it to work using a Table"indexVals" property node.   

 

Thanks for the help.

Download All
Message 4 of 7
(1,586 Views)

That looks MUCH better.

0 Kudos
Message 5 of 7
(1,582 Views)

You still have some serious flaws, for example the U32 subtraction will result in a gigantic number for the first few iterations. Also you really should make it scalable. There is a property node to detect how many rows are showing in the table indicator.

 

Try this instead:

 

altenbach_1-1600449414207.png

 

 

Note that you need to do the subtraction as signed integers to prevent rollover. You know the sized based on [i] so there is no need to measure the array size with every iteration.

 

Also note that it is safer to build the 2D array before the loop. Now the shorter array will get padded and the longer array will determine the number of iterations. If you autoindex on both arrays, the shorter will win. (no issue here since you say that the array have the same size, but it is always better to code more flexible and forgiving) 

 

If the sizes are not gigantic, another option would be to insert each new row on top (simply swapping the inputs to "built array"). Now the scroll position can remain at zero and you always see the latest N rows. (This is slightly less memory efficient, but does not matter here).

 

0 Kudos
Message 6 of 7
(1,568 Views)

Also, since you don't show the table scrollbar or index display, you really only need to keep the last few entries in the shift register, keeping the array from growing without bounds. Here's how that could look like.

 

 

altenbach_0-1600451303316.png

 

0 Kudos
Message 7 of 7
(1,563 Views)