08-09-2010 04:07 PM
I would like to create a sub that would...
1. take multiple type of input such as I16, I32, single, double, etc through a single input terminal.
2. be able to tell what is the input type in my program. For example, if my programs can take I16, I32, single, double through an single input terminal, and the input is supposed to be single, how do I tell that it is? I would like to perform a different action on the input depending on the type.
How do I do that?
Yik
08-09-2010 04:13 PM
It sounds like you want to work with "polymorphic" VI's.
08-09-2010 04:15 PM
I think what you are looking for is basically a vi with a varient input, then identifiying within the vi what was passed in (there are OpenG tools that will do that) so that you can handle the input data appropriately. Do a search on varients, there is a wealth of "stuff". If you can, download the OpenG.org libraries, there are a bunch of "varient" tools.
08-09-2010 04:19 PM - edited 08-09-2010 04:20 PM
I'll also suggest Variants, there is some good stuff in vi.lib including 'GetTypeInfo.vi'
Whatever you wire to the subVI will get coerced to a Variant for you. Not as 'pretty' as a polymorphic, but you'll get used to the Red Dot.
08-09-2010 04:52 PM
Thanks!
08-09-2010 05:01 PM
If I were doing it, I would use a polymorphic vi. No extra code needed to take a variant and determine the data type, then converting. The drawback is that you need to duplicate the vi for all expected data types. But hey, copy and paste is pretty easy.