cancel
Showing results for 
Search instead for 
Did you mean: 

String data to Sign data

KRAZE4LV
Active Participant

String data to Sign data

Message contains an attachment

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.

 

11 REPLIES 11
KRAZE4LV
Active Participant

Re: String data to Sign data

Message contains an attachment

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

I tried some conversion method.

Please see the attached.

GerdW
Knight of NI

Re: String data to Sign data

Message contains an image

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 LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
jcarmody
Trusted Enthusiast

Re: String data to Sign data

Message contains an image

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

KRAZE4LV
Active Participant

Re: String data to Sign data

Message contains an attachment

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.

 

GerdW
Knight of NI

Re: String data to Sign data

Message contains an image

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 LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
odiseo123
Member

Re: String data to Sign data

Message contains an attachment

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,

 

jcarmody
Trusted Enthusiast

Re: String data to Sign data

Message contains an image

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

KRAZE4LV
Active Participant

Re: String data to Sign data

 

Sorry! GredW that I misspelled your name.Smiley Surprised

 

Thank you all for your suggestions!

Special thanks to Jim and GredW for your help.

 

GerdW
Knight of NI

Re: String data to Sign data

Hi Kraze,

 

"Sorry! GredW that I misspelled your name."

Again misspelled two times...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019