Problem with writing a matrix to jxf File and reading it back to Jitter

Connector's icon

I still did not get an answer to my question so i try to edit my original post for better understanding and reproducing my Problem to hopefully some hints to my issue:

I am writing an jitter external for Max 9.0.8 with max-sdk-8.2.0:

max.testexternal.c.txt
txt 1.61 KB
testexternal.c.txt
txt 5.39 KB

Inside the external i am filling a 2x2x3 matrix and storing the matrix to brightnessTest.jxf in the Filesystem. After reading back into a matrix object i want to get the stored Values back in a jitter Patch.

Testexternal.maxpat
Max Patch

While storing the values to the matrix with this code:

for (x->currentframe = 0; x->currentframe < 3; x->currentframe++) {
    for (i = 0; i < x->nrOfCells; i++) {
        yCellPos = i / x->cols;
        xCellPos = i % x->cols;

        brightness = 25. * i;
        post("i: %ld", i);
        post("x->currentframe: %ld, xPos: %ld, yPos: %ld", x->currentframe, xCellPos, yCellPos);
        post("brightness: %f", brightness);

        brightnessp = brightness_bp  
            + xCellPos * sizeof(float) 
            + yCellPos * sizeof(float) * (&brightness_minfo)->dim[0]
            + x->currentframe * sizeof(float) * (&brightness_minfo)->dim[0] * (&brightness_minfo)->dim[1];
        *brightnessp = brightness;

    }
}

The output to console looks fine (frames 0,1,2 are filled with values):

storing values to 2x2x3 matrix inside c-external

But when i try to read back the matrix values in the patch

it seems that only the first frame (frames 0) was read back correctly. At the second frame (frames 1) i only get 0. Values and the third frame (frames 2) i get no Values.

reading values from matrix

Hope anyone could give me a hint to solve my problem.

Connector's icon

I have edited my original post from Aug 11 for better understanding my Problem. Hope that anyone can help me.