LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String data to Sign data

I am using a device where I receive a string data output which has a meaning.

For example:

:000000 -0067U 0004 -0578

:000000 -0067U 0004 -0578

:000000 -0066U 0004 -0579

:000000 -0066U 0003 -0579

:000000 -0066U 0003 -0580

 I need to extract the 9th and 11th character through a string subset.

I have a question, please the attached VI:

1. Is it correct extraction method? any other suggestion?

2. The 9th character actually is the sign of character 11 i.e +(if space) and - (is shown as minus)

Then I have to take this number for e.g -5  or +5 then use in another calculation but problem is how can I convert the _ and +  from string to the number? then how can I make the 9th and 11th character as one number.

 

0 Kudos
Message 1 of 12
(1,471 Views)

For the second question, for there is a space if + but - for negative.

I tried some conversion method.

Please see the attached.

0 Kudos
Message 2 of 12
(1,465 Views)

Hi Kraze,

 

given your description of the problem and the provided data I would try this:

check.png

 

"Then I have to take this number for e.g -5  or +5"

In your example data 'this number' is always zero...

 

"how can I make the 9th and 11th character as one number."

- Use comparison functions like "equal to -" and simple math?

- Explain what you really want and give examples that fit...

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
Message 3 of 12
(1,463 Views)

I'm not clear on the requirements, but I'm thinking this:

 

string[1].png

 

Can you tell us what the output should be for this input?

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 4 of 12
(1,453 Views)

Hello Jim and Greg,

Thanks for your replies!

Please see the attached VI I have seperated out the VI as per suggestion given by you two.

GregW as per your suggestion how can I get the number as -7 or -8 coz we ae extracting the numbers seperately.

Jim I didnt get the output, received as per the pic you posted. Please see the VI and suggest.

 

0 Kudos
Message 5 of 12
(1,436 Views)

Hi Kraze,

 

is it so hard to set up some simple math to combine sign and number?

check.png

Btw. you wrote my name two times in your VI - both times spelled wrong. Is the name too long or to hard to spell?

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
Message 6 of 12
(1,422 Views)

Maybe the last part can be simplified. Please see the image.

I modified your input a little bit since your data only contained "minus". I changed row 2 to have a "space" which should be interpreted as positive sign. Moreover, row 4 shows a explicit "plus" sign in the ninth position. Note that both space and plus are correctly interpreted as positive.

Consider sanitizing the input. The 0th-row with "-0587" does not follow the syntax of all the other rows so it should be removed.

Regards,

 

Message 7 of 12
(1,408 Views)

You still didn't explain what the output should be for this input.

 

Example_VI.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 8 of 12
(1,402 Views)

 

Sorry! GredW that I misspelled your name.Smiley Surprised

 

Thank you all for your suggestions!

Special thanks to Jim and GredW for your help.

 

0 Kudos
Message 9 of 12
(1,369 Views)

Hi Kraze,

 

"Sorry! GredW that I misspelled your name."

Again misspelled two times...

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
0 Kudos
Message 10 of 12
(1,353 Views)