LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Building a table with a string data type

I am using the Build Table function and I would like to be able to label my columns on the first iteration with a string data type, which doesn't seem to be an acceptable signal for the Build Table function. However, the express table is located under "text indicators" on the front panel, so it seems like there should be a way to do this..
0 Kudos
Message 1 of 7
(8,879 Views)

Hi apatt,

where is your question? If you use a table you can use the properties to set the column and row header.

Mike

0 Kudos
Message 2 of 7
(8,874 Views)
Ah, the "Build Table" Express VI. I hate Express VIs.

That Express VI is nothing more than a really complicated way of creating a 2D array of strings. The Express VI has no inputs for the row and column headers, so you need to add them in yourself. The same would be true for a regular table control/indicator. Here's what you need to do:
  1. Right-click on the table indicator and select Visible Items -> Column Headers.
  2. Right-click on the table indicator and select Create -> Property Node -> Column Header Strings[]. LabVIEW will attach a property node to the cursor and switch to the block diagram. Plop down the property node on the block diagram.
  3. Right-click on the property node on the block diagram and select "Change All to Write".
  4. Right-click on the property node and select "Create -> Constant". This will give you an array of strings, and you can enter the column headers in each array element.
  5. Wire the array to the property node.
  6. Connect the property node to the Build Table Express VI using the error clusters.



Message Edited by smercurio_fc on 07-02-2008 09:25 AM
Message 3 of 7
(8,868 Views)
Excellent, that worked. Thanks a lot for your help!
 
Apatt
0 Kudos
Message 4 of 7
(8,858 Views)
Oops, not done yet.
 
When I write the table to an excel file, I want to write the headers to excel as well (this method does not do that). I may still need to make the first entry in each column a string. Is there a way to do that? Or is there an easier way to write the headers to an excel file?
 
Thanks,
 
Apatt
0 Kudos
Message 5 of 7
(8,854 Views)
First you have to clarify whether you're talking about an actual Excel workbook, or a spreadsheet-like file, as generated by Write to Spreadsheet File. If it's the latter, all you need to do is to write out the headers first, followed by the data:




Message Edited by smercurio_fc on 07-02-2008 10:37 AM
0 Kudos
Message 6 of 7
(8,850 Views)
Perfect -- that is exactly what I wanted. Thank you!
0 Kudos
Message 7 of 7
(8,820 Views)