NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change string to numeric which get from file?

hello,

As a beginner of teststand, I meet with the issue as follow.

When I want to do with the data from external file, like csv, I find I can't change string directly to numeric.

How can I do with this?

Thanks in advance.

temprst.PNGprocess.PNGFinalrst.PNG

0 Kudos
Message 1 of 7
(3,358 Views)

This is because your string is not a valid number.  "3b" is not a number.  What is it supposed to be?

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 7
(3,336 Views)

Jiggawax is correct but also using things like "evaluate" is sometimes helpful.

For example you could do something like:

Locals.MyNumber=Evaluate(Locals.MyString)

Message 3 of 7
(3,332 Views)

TTEng, I assume you mean 0x3B (i.e., it's a hex number).  If so, jigg has already answered your question here:

 

https://forums.ni.com/t5/NI-TestStand/How-to-convert-string-having-Hex-data-into-number/td-p/1605804

 

If not, please provide some more clarity...

0 Kudos
Message 4 of 7
(3,325 Views)

@croohcifer wrote:

TTEng, I assume you mean 0x3B (i.e., it's a hex number).  If so, jigg has already answered your question here:

 

https://forums.ni.com/t5/NI-TestStand/How-to-convert-string-having-Hex-data-into-number/td-p/1605804

 

If not, please provide some more clarity...


Your Right Jigg already provided the answer, all I was saying (not for his provided example) is that you can also use "evaluate" in some cases as that's a function i was unaware of until more recently.

0 Kudos
Message 5 of 7
(3,320 Views)

Ah, sorry TTeng, I meant to direct that response to the OP ixtly.

 

Yes, you can also definitely use Evaluate() to convert a string to a number with the similar syntax, like Evaluate("0x" + Locals.HexString)  

 
0 Kudos
Message 6 of 7
(3,318 Views)

Sorry for my poor expression, before TestStand I used to program with labview. What I want is that to get the numeric from the beginning of string, like doing so by the way of labview as follow.

 

lvway.PNG

0 Kudos
Message 7 of 7
(3,309 Views)