Hello, is there a way to create mxArray from double *?
7 ビュー (過去 30 日間)
古いコメントを表示
Hello, is there a way to create mxArray from double *?
0 件のコメント
採用された回答
José-Luis
2012 年 11 月 15 日
編集済み: José-Luis
2012 年 11 月 15 日
If by create you mean typecasting, then no. If by create you mean populate then yes:
mwSize m = 100, n = 10; //Array size
double * yourData = new double[m*n]; //Need to populate with the data you want
mxArray *pa = mxCreateDoubleMatrix(m, n , mxREAL)
double *startPa = mxGetPr(pa);
//In C
memcpy ( startPa, yourData, m*n*sizeof(double) );
//Alternatively
copy ( pa, pa+(m*n), yourData );
delete yourData;
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Call C++ from MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!