How to return a uint64_t from a mex function?

3 ビュー (過去 30 日間)
Shlomo Geva
Shlomo Geva 2021 年 11 月 22 日
コメント済み: Shlomo Geva 2021 年 11 月 22 日
I want to assign to plhs[0] a scalar of type uint64_t.
Not sure what function to call.
e.g. if I have
uint64_t y=123;
and I want to return y to Matlab
I tried
plhs[0] = mxCreateDoubleScalar(y);
But this is not the right call as it is not a double. How to create a uint64_t variable in the mex function? in there another mxCreate...

採用された回答

Bruno Luong
Bruno Luong 2021 年 11 月 22 日
mxArray *A;
A = mxCreateNumericMatrix(1, 1, mxUINT64_CLASS, mxREAL);
*(mxGetUint64s(A)) = 123;
  1 件のコメント
Shlomo Geva
Shlomo Geva 2021 年 11 月 22 日
Yep, thanks!!

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by