LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

different type data

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

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 6
(2,707 Views)

It sounds like you want to work with "polymorphic" VI's.

Message 2 of 6
(2,702 Views)

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.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 3 of 6
(2,700 Views)

I'll also suggest Variants, there is some good stuff in vi.lib including 'GetTypeInfo.vi'

 

21007i159B34340308C300

 

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.

Message 4 of 6
(2,696 Views)

Thanks!

 

 

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 5 of 6
(2,676 Views)

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.

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 6
(2,668 Views)