03-19-2013 12:07 AM
Hello,
I'm writing a program which parses data from a large input cluster so it can be written to a more well known format for reading later. I am trying to find a way to determine if a variant is a 1D array or a 2D array.
I have written a routine which will determine if the variant is an array, as well as the type of array (dbl, i32, etc), however I am not sure how I can tell if the array is 1D or 2D so I can know what I should to wire up on the 'variant to data' block's 'type' terminal.
When I look at the variant as an indicator, if it is a 2D array is see something like [33x236], if the array is a 1D array I see something like [256], but is there any way to programmatically tell if I am dealing with a 1D array or 2D array? Sorry if I am missing something obvious.
Any insight is much appreciated!
Best Regards,
Michael
Solved! Go to Solution.
03-19-2013 01:13 AM - edited 03-19-2013 01:14 AM
Ok, so I figured out a way to do this based on the flatten to XML block, however I'm wondering if there is a more elegant way?
Any insight is much appreciated!
03-19-2013 03:08 AM
Look at the VIs in <vi.lib>\Utility\VariantDataType
03-19-2013 09:23 AM - edited 03-19-2013 09:24 AM
Awesome! That is much easier than what I wrote myself. Thank you tst! BTW what's up with these locked VIs? Are they NI proprietary? I'm wondering if they actually use flatten to XML and parse it anyways, or they have some NI tricks.
Regardless thanks again! You have been very helpful!
03-19-2013 09:31 AM
@mkabatek wrote:
Are they NI proprietary? I'm wondering if they actually use flatten to XML and parse it anyways
Yes to the first and "probably no" to second. If the second was "yes", then the VI would probably not be locked.