06-16-2016 09:00 AM
I'm looking for some help with converting an array of string elements into a cluster with named elements of different datatypes.
I'm importing data from an Excel spreadsheet. It is coming into LabVIEW as 3 separate arrays (of Strings): 1) Variable name, 2) Datatype (three possibilities Int, DBL, String) and 3) Value, with the indices in each array corresponding to a separate variable (I have approxiamtely 180 variables to import). My end goal is to convert the "Value" string array into a cluster. But I want the datatype to be correct in the cluster and I also would like the name of the elements in the cluster to correspond with the "Variable Name" string array so that I can use the Unbundle by Name function in my main VI.
Please see the attached a SubVI for more details. I made the size of the imcoming arrays 5 elements for simplicity. I realize that owned labels cannot be changed during runtime and I don't think that I need to do this. I just want to use the output cluster (mostly the unbundle by name) to help with designing my main VI. I will need to 'read from' and 'write to' the cluster during runtime but I will not need to change the element names.
I was also wondering if there a better way to import the data from Excel? Is there a way to import directly into a cluster right away rather than bringing everything in as strings? I've attached a SubVI showing how I am currently bringing in the data (found it on the forum somewhere). It comes in as a 2D array, which I split into the 3 separate arrays that I mention above.
I'm open to any and all suggestions. Thank you very much.
-Mike
Solved! Go to Solution.
06-16-2016 12:21 PM - edited 06-16-2016 12:21 PM
Instead of trying to create a cluster, I think I would just use Variant Attributes.
06-16-2016 01:35 PM
Thank you. I have never used variants before so I am new to this concept, but I can make this work. It will take a little more work on the back end to pull the right variable (rather than just selecting from the unbundle by name function) but that's ok.
Cheers,
Mike