Dear Community,
I've got this problem where I need to interface an old C-algorithm into my new Matlab program.
This C-function needs as one input a double*** array. I allacoate some memory inside the mexFunction via:
double ***rv_solve;
rv_solve = (double ***)mxCalloc(X_SIZE, sizeof(double *));
for (i = 0 ; i < X_SIZE; i++) {
rv_solve[i] = (double **)mxCalloc(Y_SIZE, sizeof(double *));
for (j = 0; j < Y_SIZE; j++)
rv_solve[i][j] = (double *)mxCalloc(Z_SIZE, sizeof(double *));
}
The C-function manipulates this 3D array and I want this array back into my Matlab workspace.
The output gets assigned by
rv_solve_out = (double *)mxGetPr(plhs[2]);
How do I now associate double*** rv_solve with double* rv_solve_out ?
All I found on the web and the documantation is about 1-Dim arrays. I would love to use just 1-Dim arrays and use superindexing, but I need this C-function and it is complicated enough not to rewrite it for 1-Dim inputs.
And probably there is an easy solution, as most times, but I'm just to stupid to find or recognize it.
Thanks in advance.
Cheers Achim