LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I convert data in string into all available data types in Labview?

Solved!
Go to solution

The parsed data from XML Parser gives me all the data and specifications in the string format. I want to convert these data into various (all available)  data types. Is there a possible solution for it?

0 Kudos
Message 1 of 16
(7,186 Views)

Can you specify a particular data type that you are not able to?

0 Kudos
Message 2 of 16
(7,179 Views)
0 Kudos
Message 3 of 16
(7,165 Views)

Thank you for the suggestion.

But I need something that can change e.g. String: ''10'' in to I-32 ''10''. Type cast gives me the value related to string that is ''1952804352'' in I-32 indicator. I don't know how to use that value to get ''10''.

0 Kudos
Message 4 of 16
(7,126 Views)
Solution
Accepted by topic author R_Chintan

Use decimal string to number

19831i8A73FEB3D492D745

0 Kudos
Message 5 of 16
(7,118 Views)

 


@muks wrote:

Use decimal string to number

19831i8A73FEB3D492D745


Specifically, you can define a constant with a different datatype on the input on the lower left if you need a different datatype (e.g. U8, I64, DBL, etc) Are all your values integers or do you also need to scan fractional numbers? In this case, you should use "fract/exp string to number" instead.

 

0 Kudos
Message 6 of 16
(7,113 Views)

Yes you are right.

I can change integers only. All integeer types.

 

But I want all possible datatypes in input so that I can change them to appropriate output.(U8, 16, 32, Double, string, etc)

0 Kudos
Message 7 of 16
(7,098 Views)

 


R_Chintan wrote:

But I want all possible datatypes in input so that I can change them to appropriate output.(U8, 16, 32, Double, string, etc)


 

Do you still have a question or are you just repeating my answer in slightly different words?

 

(The input is always string, and for the output you need to decide on the most appropriate datatype when designing the program. I am curious why you would specify string as a possible output. Since you already have a string, no code is needed for this, right?)

0 Kudos
Message 8 of 16
(7,086 Views)

The default conversion is I32. Right click properties and choose the required conversion required.

 

19841iB4CEFFC45C3D6CF0

0 Kudos
Message 9 of 16
(7,077 Views)

 


@altenbach wrote:

 


R_Chintan wrote:

But I want all possible datatypes in input so that I can change them to appropriate output.(U8, 16, 32, Double, string, etc)


 

Do you still have a question or are you just repeating my answer in slightly different words?

 

(The input is always string, and for the output you need to decide on the most appropriate datatype when designing the program. I am curious why you would specify string as a possible output. Since you already have a string, no code is needed for this, right?)


I suspect the poster is looking for something like a "dynamic" Scan From String function. One where you enter the format string programmatically, and the outputs "automagically" change datatype at run-time. Such a beast, of course, does not exist. If this is the case, I would suggest using a polymorphic VI instead (one that would use a numeric constant to select the specific type of conversion so you'd get the "appropriate" datatype for the output).

 

0 Kudos
Message 10 of 16
(7,062 Views)