LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

converting enum into varient

I am wondering if we can convert enum data type into variant. I could not find literature regarding variant data type.

0 Kudos
Message 1 of 14
(3,457 Views)

You can cast anything into a variant.  That's the point of the variant.  However, you have to convert back at some point.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 14
(3,453 Views)

What is the "thingie" that needs the variant? You may need to first convert the enum to a numeric value prior to converting to a variant. But that really depends on what's the thing that's using the variant.

0 Kudos
Message 3 of 14
(3,447 Views)

First question: why do you "need" the variant.

0 Kudos
Message 4 of 14
(3,441 Views)

I want to develop application which change the output base of the selection of enum and the data could be send via USB using api. I believe i am not able to by the use of variant. without varant it is working.

0 Kudos
Message 5 of 14
(3,427 Views)

Sorry the attachment is required vi

0 Kudos
Message 6 of 14
(3,423 Views)

I don't understand your problem.

 

For your posted VI, I would just use the I32 conversion bullet.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 14
(3,416 Views)

This is snippet  of a sub vi. 

   the sub recieves different kind of data integer, float, double etc 

 like

0 Kudos
Message 8 of 14
(3,399 Views)

Well if you are using floats and doubles to index an array you may run into problems due to rounding. What element should be selected if the input is 2.5? Still not entirely clear what exactly you are trying to do. Are you trying to do something like this?

 

ENUM Variant Selection.png



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 9 of 14
(3,395 Views)

i believe Chosing case is not a Problem.   The sub vi process different. One of the case I have explain in the vi above. the Enum data I have to insert into the array. Without the varient setup it is working fine. If you suggent me to remove it altogether. 200 additional case i will have do design.  I believe when i change the enum data into varient and then back, some thing is missing which I dont know about.  

0 Kudos
Message 10 of 14
(3,376 Views)