02-29-2012 02:26 AM
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.
02-29-2012 02:46 AM
For the second question, for there is a space if + but - for negative.
I tried some conversion method.
Please see the attached.
02-29-2012 02:59 AM
Hi Kraze,
given your description of the problem and the provided data I would try this:
"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...
02-29-2012 05:42 AM
03-01-2012 07:18 PM
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.
03-02-2012 02:15 AM
03-02-2012 06:11 AM
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,
03-02-2012 06:25 AM
03-04-2012 07:15 PM
Sorry! GredW that I misspelled your name.
Thank you all for your suggestions!
Special thanks to Jim and GredW for your help.
03-05-2012 02:20 AM