Hi, i would normally ask my tutor at uni, but i can’t at the moment. I’ve gone through loads of tutorials but i can’t seem to get much progress on formatting my data in the way i want.
i’m reading data from a serial port and if I print, my data looks like this:
I need the data to look like this:
print 11 203
print 12 1002
Any ideas would be really appreciated!
I’ve trying zl group/pack and a whole bunch of other things but i’m having no luck. If anyone could point me in the right direction, I would be very happy!
okay i’m using:
"match x nn nn y nn nn nn"
to grab the chunks of data, now the data looks like:
print x 1 1 y 2 0 3
So is their a way of removing the x and y chars from the data and making the 1 1 into 11 etc, so the data looks like
print 11 203
Answered too fast!
[zl filter] would be just to filter the x and y.
Here you go with a [sprintf] in addition.
You could also do everything at once with [regexp].
thank you so much.
I used [springf %s%s%s%s%s%s%s] to remove the spaces and [zl filter x] to remove the x and same for the y.
I feel like a right newb, but i really didn’t know about the sprintf thing.
Thanks a million, much appreciated
Log in to reply
SUBSCRIBE TO OUR NEWSLETTER
C74 RSS Feed | © Copyright Cycling '74 | Terms & Conditions