Forums > Java

matrix to array jitter mxj

July 17, 2011 | 10:58 pm

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;



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.

July 17, 2011 | 11:46 pm

Figured it out guys, thanks anyway..

January 21, 2016 | 4:47 am

Old post but it would be highly useful to me and other users to see how you managed to fix this problem?
Do you still have the file available and would be happy to post it up here?


Viewing 3 posts - 1 through 3 (of 3 total)

Forums > Java