From 12:00 AM CDT Sunday, October 17 - 11:30 AM CDT Sunday, October 17, ni.com will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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
(502 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
(476 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.

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 3 of 7
(455 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
(429 Views)

That looks MUCH better.

0 Kudos
Message 5 of 7
(425 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).

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 6 of 7
(411 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

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 7 of 7
(406 Views)