getcell() returns null and I don't know why … :(

Nov 11, 2013 at 1:48pm

getcell() returns null and I don't know why … :(

Can someone help me with this piece of code I just wrote …?

p_array is null line 25

This is the line of the if()

I even filled (dumbly) the p_array slots… but no way.

autowatch = 1;
outlets = 2;

var w = 15;

var outmatrix = new JitterMatrix(3,"float32",w,1);

var scalematrix = new JitterMatrix(3,"float32",w,1);

var p_array = new Array(3);
p_array[0] = 0;
p_array[1] = 0;
p_array[2] = 0;

function bang()
for (var i = 0 ; i < w ; i++)
p_array = outmatrix.getcell(i);

if (p_array[0] < 20) p_array[0] += Math.random();
else p_array[0] = 0;



Nov 11, 2013 at 3:16pm

I don’t get any errors with your code. I do, however, get a Max window error message from the outlet() call on line 11:

js: bad outlet index 1 [test]

This is because your outlet doesn’t yet exist. You should call it in one of your functions to be sure that the object is constructed properly. I believe the loadbang() function executes automatically if you define it. Outlet() calls are safe there.

Nov 11, 2013 at 4:18pm

No errors for your array assignement…
for your setting method of matrix, you declare variable “outmatrix” as a 2D BUT you call method setcell3D, try “outmatrix.setcell2d([i,0],p_array)” to set your datas

Nov 12, 2013 at 6:51am

omg, I don’t have any error now.

right for the 2d/3d
I’m in 3 coordinates so 3d works right!


You must be logged in to reply to this topic.