1

I got a continuous stream of byte data receiving from websocket. When I view the data with this function:

document.getElementById('log').innerHTML = document.getElementById('log').innerHTML + msg + "<br />";

It would look like this:

-0.00005645785104823496
0.00000906544783255643
-0.001234972515485563
0.00000008534781277461
.
.
.

I want to fill it in an array that would look like

var inp = new Array(event.data)
  , arr = new Float32Array()
  ;
for(var i = 0;i <arr.length; i++) {
    arr[i] = inp[i];
}

How do I fill the inp[i] array with data receiving from websocket.

Thanks

2
  • What is your desired outcome? do you need the - and the .? Commented May 7, 2013 at 9:33
  • I want to fill in arr[i] with data receive from websocket. How do I make event.data to become inp[i] in the first place. So I can match each inp[i] with the arr[i]. Thank you Commented May 7, 2013 at 9:36

1 Answer 1

2

I found the answer, it was:

shifted = inp.shift();

Thank you for any help.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.