dynamically allocated c++ array covert-convert to mxArray
Mostrar comentarios más antiguos
Hello every one, i am new to matlab. So what i am trying to do is solve a problem like: Ax=B
I get a nXn matrix from my c++ code and i want to pass its values to mxArray. Specifically i do something like:
double **Ac = NULL;
Ac = new double*[size];
for(i = 0; i < size; i++){
Ac[i] = new double[size];
}
mxArray *Am = NULL;
Am = mxCreateDoubleMatrix (size, size, mxREAL);
memcpy( ( void* )mxGetPr(Am), ( void* )Ac, size*size*sizeof(double));
engPutVariable(ep, "Am",Am);
engEvalString(ep, "plot(Am);");
It shows a plot but not the correct one. Any directions?
Thank you all
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre C Shared Library Integration en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!