03-20-2019 04:21 AM - edited 03-20-2019 04:22 AM
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.
03-20-2019 08:34 AM
This is because your string is not a valid number. "3b" is not a number. What is it supposed to be?
03-20-2019 09:15 AM
Jiggawax is correct but also using things like "evaluate" is sometimes helpful.
For example you could do something like:
Locals.MyNumber=Evaluate(Locals.MyString)
03-20-2019 12:46 PM
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...
03-20-2019 03:33 PM
@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.
03-20-2019 03:44 PM
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)
03-20-2019 08:29 PM - edited 03-20-2019 08:32 PM
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.