dynamically allocated c++ array covert-convert to mxArray
Mostra commenti meno recenti
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
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su C Shared Library Integration in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!