LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array of strings or numbers to table display

What I have is a set of strings.  The strings are then concatenated and then initialized into two separate arrays.  I next build an one array composed of the two original arrays.  After transposing the array i put it into a table for display.   My problem is:  I need my data to wrap around if the data is too long for the column width and also i noticed in some of the examples that you can label a wire going into the "build array" vi and then it will correspond to the column title in the table. how do you do that?  i also wanted to try doing this by converting the string array into a numeric array (in case i need to mask out bits and then graph the data).  Would it be better to to just use a numeric table since i need to display in a graph, and any suggestions on the best way to do that as well.  So if i could have advice or someone could add onto my vi attached that would be greatly appreciated.  Thank you
0 Kudos
Message 1 of 10
(4,351 Views)
Can you put in vertion 7?
0 Kudos
Message 2 of 10
(4,331 Views)
You can use a function called Reshape Array to specify that it take a certain shape. For instance, if you have an array with 5 elements, and you want to fill it in as a row on your table, but you only want to have 4 columns in the table, then you can reshape your 5 element 1D array as a 2D array with 4 columns and 2 rows. Your array would then have 4 elements in the first row and one in the second. Then, instead of using Build Array to combine your 1D arrays, use Build Array to combine all your newly reshaped 2D arrays with Concatenate Inputs checked on Build Array (right clickt the function to see that option). Instead of creating a 3D array from the inputs, it will paste the 2D arrays together into one big 2D array.

Here's an example in LV 8 and saved down to LV7.0

Message Edited by Jarrod S. on 08-18-2006 01:59 PM

Jarrod S.
National Instruments
Download All
0 Kudos
Message 3 of 10
(4,326 Views)
Upon rereading your original post, it appears as though you want the data in each cell to wrap around if it doesn't fit in the column. I took that to mean you wanted the columns themselves to wrap over to the next row. Oops... 🙂
Jarrod S.
National Instruments
0 Kudos
Message 4 of 10
(4,319 Views)
I am wondering if the column width is fixed then is there a way to get the remaining strings to return to the next line but stay in the same row.

if a string was 123456789 but the column could only display 12345 is there a way to make it look like   12345
                                                                                                                                                                     6789

and stay in the same row instead of having to adjust the column width.  Also how do you name the headers for the column for how i mentioned it in my first post.
0 Kudos
Message 5 of 10
(4,315 Views)
when i submitted my post it came out wrong.
it should look like:
12345
6789


0 Kudos
Message 6 of 10
(4,311 Views)
"i noticed in some of the examples that you can label a wire going into the "build array" vi and then it will correspond to the column title in the table. how do you do that?"

Where did you notice that? That doesn't ring any bells with me. You can set the column headers programmatically using a Property Node for the Table called Column Headers[ ]. It accepts an array of strings, one for each column header. That would be my best advice.

Regarding your other problem of column width wrap-arounds: there isn't any option you can select in LabVIEW to enable word wrapping, but you could write the code for it yourself in LabVIEW. In order to have an effective algorithm, though, you would need some type of monospace font where each letter takes up exactly as much space as the others. Otherwise, reading the number of characters in your string won't give you an exact indication of its length in the column (it wouldn't be too bad an approximation, though).

What might be easier would be to autosize your columns, which was discussed in this post. Hope this helps!
Jarrod S.
National Instruments
0 Kudos
Message 7 of 10
(4,303 Views)
the vi that does the labeling is called "Building Tables" and is found in the example.
0 Kudos
Message 8 of 10
(4,300 Views)
Ah, I see your confusion. Whoever built that example manually typed in the names of the column headers. The free text labels over the wires on the block diagram are to document the code. They serve no true functionality. If you want to change column headers programmatically, you will have to use the Column Headers [ ] property node and wire in an array of strings. No other way...

Jarrod S.
National Instruments
Message 9 of 10
(4,290 Views)
ok thanks for the help and examples.
0 Kudos
Message 10 of 10
(4,286 Views)