01-17-2011 09:09 PM
Hello Dear;
Could u help me out on the following problem?
I have a string like:
Roll: -3.345 Pitch:54.90 Yaw:-120.01
I want to receive just numbers from this string. The length of numbers are different; sometimes positive and sometimes negetive either float or integer numbers.
What I got from my code is very clumsy, could you correct me?
I attached the necessary part of code, that is worked for this string:
Result: -3.345,54.90,-120.01
If you have any suggestion, what will work instead of [*,], please let me know.
Thanks;
01-17-2011 10:58 PM
Try this.
01-18-2011 01:04 AM
Hi
Try using scan from string with the below format string
%[a-z,:,A-Z]%f%[a-z,:,A-Z, ]%f%[a-z,:,A-Z, ]%f
also see the attched image..
01-18-2011 11:19 AM
01-19-2011 12:49 PM
Thanks all for reply.
It doesn't work. Let me send you my complete program.
The data continuosly comes from the serial port. After I filter the numbers, I will send them ona file.
I attached my previos work which works now. And the new veersion which I am looking for, this version is based on helpof you guys.(Thanks).
Best;
01-19-2011 01:03 PM
Ben,
I tried your regexp too, the output was empty.
01-19-2011 01:31 PM
@skh wrote:
I have a string like:
Roll: -3.345 Pitch:54.90 Yaw:-120.01
Is this the exact string that you receive or just something close? There is a blank space between Roll: and the following number but not for pitch and yaw. Can you post the content of the read buffer output of the VISA Read function? (connect a string indicator to this outpu)
You can also try the following regex: \s*Roll:\s*([-\d\.]+)\s*Pitch:\s*([-\d\.]+)\s*Yaw:\s*([-\d\.]+)
Ben
01-19-2011 03:03 PM
Thanks Ben;
The second expression worked great:).
s* before the Roll, Pitch , Yaw means a string?
Cheers;
01-19-2011 03:55 PM