LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

data type detection

Hello

 

in my program i want to place a check if the comming data is int8,int16 or int32 based on that i have a case structure which will further select what to do if data is int8 then do this if int16 then do this etc.what is the suggestion regarding finding the data type means if it is  int8,int16 or int32 etc

 

 

regards

 

0 Kudos
Message 1 of 5
(3,259 Views)
you can flattern your u8, u16 and u32 data, and test the flatterned strings length for distinguishing.
0 Kudos
Message 2 of 5
(3,256 Views)
If you are talking about the data type of the wire (as opposed to the range), then you probably want a polymorphic VI. This will allow you to write several VIs (one for each data type) and it will automatically select the correct one based on the type of wire you wire into it.

___________________
Try to take over the world!
Message 3 of 5
(3,241 Views)

You can also use the "GetTypeInfo" VI found in the vi.lib\Utility\VariantDataType folder:

 

I would agree with tst, though, that the polymorphic VI is probably the best option.

Message Edited by smercurio_fc on 05-12-2010 09:09 AM
Message 4 of 5
(3,218 Views)
polymorphism is the best solution to this problem,I made the mistake of thinking that i8, i16, i32 can not distinguish by the poly mechanism. It is a pity that I firmly know that foo(int a), foo(long int a) can be overloaded in c++, but I failed to translate my knowledge in c++ to labview.
0 Kudos
Message 5 of 5
(3,193 Views)