Converting ASCII to numbers
Hey guys
I'm wondering if there is a way to convert ascii to numbers in max?
Any help would be greatly appreciated
[atoi]
@Wetterberg Thanks :) I tried that out and I'm getting one small problem.
When I try convert the ascii I don't get a . in my number box.
The numbers are coming from a group object and in ascii 46 = . but that isn't coming through in my flonum object. Any reason this might be happening? I'm using a fromsymbol object as well is this necessary?
post your patch :) Remember to use Copy Compressed.
well, "." isn't a number, so you can't really "convert" to it. Are you sure you don't want to convert from integers *to* ascii?
@WETTERBERG Here's the code. I'm getting the input through a programme called hyperIMU which transfers data through a wifi network and this data comes in in ascii
right, so you're processing an ascii as integers, but then you're turning it into ascii with atoi - that way your flonum obviously won't work with the ".".
Tell me what you're trying to achieve with this patch again? I think there has to be a different - and simpler - way of solving this. And I'm fairly sure it doesn't involve coaxing a dot through a numberbox of some sort. :)
Thanks for helping i really appreciate this :) Its for my final year project in college. I'm trying to get accelerometer data into max via hyperIMU. My problem is when I get the data in its all in ASCII and I need to convert it to its numbers to be able to use it. The raw data looks like this "50 46 57 51 54 52 56 56 52 44 45 48 46 51 55 57 52 56 48 57 54 44 49 53 46 51 54 56 51 56 49 44 35". I want to be able to convert these to the numbers they're supposed to be so that I can use them. So for example this should be 2.936484, -0.37948096, 15.36831, # the "#" means the end of the line. The patch that i linked is the basic converting idea that my supervisor suggested.
the naming of [atoi] and [itoa] might be confusing. What you need it [itoa]:
So if I added this to my patch it would be something like this?
I tried it in my patch and I'm getting no change in numbers when the data comes in :/
@JAN Thanks for all your help. I think this is certainly putting me on the right track. I'm just having trouble with the livestreaming data into the patch. I seems to work with messages but I'm not getting anything coming through when I turn on the accelerometer. I'm sure its just a small fix somewhere along the line