LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generic "Make Spreadsheet" VI

I am generating "spreadsheet-like" data in LabVIEW -- an array of a cluster with "simple" elements such as Trial Data (I32), Accuracy (Dbl), Delay (I32).  I want to create a generic VI that can take such an "array-of-cluster" and output an Excel spreadsheet, with the first row being column headers ("Trial Data", "Accuracy", Delay", for example) and the remaining rows being the corresponding values from the array of clusters.  Because I would like this VI to be generic, I though I'd make the input control be a Variant.  To make this work, I need to isolate the header information from the cluster's element names, then simply output the cluster values one row (array element) at a time.

 

To my surprise, the first part of this (taking a cluster and creating an array of strings corresponding to the names of the cluster elements) proved easy, but the second part, simply "dumping" the values contained in the cluster.  The elements in the cluster, in the "generic" case, can be of varous types, but I can deduce the types from the variant.  However, I can't seem to figure out how to get the values!  [I can get the name of the cluster element, the type of the cluster element, but not the value of the cluster element -- how backwards is that?]

 

Does anyone have suggestions for a solution?  The data are clearly there -- if I isolate a cluster (by using Index Array on the array-of-clusters) and plug it into an indicator, I can "see" the element names and values, but when I try to isolate the values one-at-a-time, I just get zeros.  I'm beginning to think that this "obvious" ability is missing ...  If anyone has a suggestion, I'm very interested.

 

BS

0 Kudos
Message 1 of 3
(2,488 Views)

Hi Bob Shor,

did you see the openg Variant library? I think it can help you.

 

Mike

0 Kudos
Message 2 of 3
(2,468 Views)

Mike,

     I had, in fact, looked at the OpenG library, specifically the OpenG LabVIEW Data Tools, which has the variant stuff in it.  I must have looked early in my investigation of this problem, and forgotten to "look again", because the VI Get Cluster Element By Name does (most of) what I need, and what I was unable to find in the NI-supplied Variant VIs.  I'll now tackle the remaining 10% (which involves TypeDefs) and try to put the whole thing together and submit to NI.

 

Bob Schor

0 Kudos
Message 3 of 3
(2,452 Views)