Should be simple: How to get a matrix into and out of javascript?

    Jun 12 2014 | 1:23 am
    Hi All, My question is pretty simple. How do I get data from a jit.matrix into a javascript (where I will do processing on it), and then how do I output a matrix when I'm done processing? For instance... In my patch I have a 11 plane jit.matrix with @name "test_table". I fill all cells in all planes with 64. I want to get that matrix into a javascript object.
    My code looks like this: function jit_matrix() { var testMatrix = new JitterMatrix("test_table"); outlet(0, testMatrix); // doesnt work outlet(1, "final_table", testMatrix); // doesnt work outlet(2, "final_table",; // doesnt work } But I don't know what I'm doing, and there is no good documentation... The jitter javascript tutorials don't really ever cover this, except for very briefly, and there are no explanations. Any help is greatly appreciated!!
    codedorf out.

    • Jun 12 2014 | 6:02 am
      It is possible to access data in a matrix using the getcell and setcell instructions. There is the jstable-example.maxpat in the jitter-examples/javascript/other folder that shows how to use them. Remember that with matrices, not the actual data, but references are handed. I didn't try, but outputting the message 'jit_matrix final_table' might do it.
    • Jun 12 2014 | 1:54 pm
      i've attached a basic example of two ways to reference a matrix using javascript.
    • Jun 12 2014 | 7:45 pm
      Thank you thank you thank you both! Although I'm still confused on how exactly javascript and jitter work together, the example helped immensely.
      One question I had was: what does the frommatrix method do? I don't see the frommatrix method in the list of methods for the JitterMatrix object here:
      where did the method come from if it's not on the list?
    • Jun 13 2014 | 5:14 pm
      it's a special method of the JS JitterMatrix object. check out jitter tutorials 45 and 46.
    • Jun 25 2014 | 5:42 pm
      Go to this link.May be it helps you to an extent. For more web applications visit at: For more web applications visit at:
    • Jun 25 2014 | 6:14 pm
      Thanks guys - I was able to successfully do what I set out to do with javascript. I wish there was more official information on how to use jitter & javascript, but oh well, glad there is at least a forum (& helpful community members) to help out with this kind of thing.
      - Codedorf out