matrix to array jitter

Jul 17, 2011 at 7:10pm

matrix to array jitter

Hi Guys,

I’m working on a mxj patch that takes a float32 matrix with only one plane, but X and Y. I want to check each element in the matrix and perform calculations on the data. I was using getCell2d(), however that was very computationally strong. I then tried to copy this matrix to an array and work on the array instead. I would then go through this succesively with a for loop for X and Y. The code compiled, but when I run the code I get an arrayOutOfBounds exception error. The documentation does not explain how the matrix is changed into an array, so am I trying to access the array in the wrong fashion? I presumed it would be transfered into an array like array[640][480], but that does not seem to be the case. I’d really appriciate any help with this as it is driving me slowly towards insanity.

Here is the code I made.. In this case I am trying to keep track of the data in the array and output the lowest value.

import com.cycling74.max.*;
import com.cycling74.jitter.*;
import java.util.*;

public class matrixIf extends MaxObject {

public void jit_matrix(String s)
JitterMatrix jm = new JitterMatrix(s);
int dim[] = jm.getDim();
int dimCap = dim[1]*dim[0];
float min = 0;
float[] test = {};
float tempFloat = 0;
int offset[] = new int[]{0,0};
// jm.copyVectorToArray(dimCap,offset,test,dim[1]*dim[0],0);

for(int i=0;i

for(int j=0;j

tempFloat = test[j];
if(tempFloat < min)
min = tempFloat;



min = 0;



Jul 17, 2011 at 7:37pm

Just to add, I have checked how many elements are being populated and its returning 0, so I must be populating it in the wrong fashion.

Jul 17, 2011 at 11:51pm

Figured it out guys, thanks anyway..


You must be logged in to reply to this topic.