Why identifier "mxGetUint64s" is undefined in mex or cudamex?

8 ビュー (過去 30 日間)
wei zhang
wei zhang 2021 年 7 月 8 日
コメント済み: wei zhang 2021 年 7 月 8 日
Hi, I am trying to deal with unsigned long format arrays in mex. I found in mxGetUint64s page that I should use mxGetUint64s instead of mxGetPr or mxGetData. But in the mini-sample script below, I always get the error "identifier "mxGetUint64s" is undefined". I had already include the "matrix.h" header file as below. Could anyone give me some suggestions?
% test.c or test.cu
#include "mex.h"
#include "matrix.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
unsigned long* ptr = mxGetUint64s(prhs[0]);
}
The following error happens with mex and cudamex both.
>>> mex('test.c') % or mex('test.cu')
error: identifier "mxGetUint64s" is undefined
Besides, if I use mxGetData with double format input, it works well as below.
#include "mex.h"
#include "matrix.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
double* key = (double*)mxGetData(prhs[0]);
}

採用された回答

Steven Lord
Steven Lord 2021 年 7 月 8 日
What happens if you build your MEX-file using the interleaved complex API by passing the -R2018a option to the mex command as shown in the API Version section on the documentation page?
  1 件のコメント
wei zhang
wei zhang 2021 年 7 月 8 日
It works well with adding option -R2018a.
mexcuda('-R2018a','test.cu');
I misleading the "interleaved complex API" to things with complex numbers.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWrite C Functions Callable from MATLAB (MEX Files) についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by