why do i receive an error message when i change phonebook.c in matlab to phonebook.cpp? with mex

2 ビュー (過去 30 日間)
se chss
se chss 2023 年 11 月 15 日
回答済み: Angelo Yeo 2023 年 11 月 16 日
if i change the phonebook.c example in matlab to phonebook.cpp, i receive an error message.
the error message line is 49.
classid flags = mx calloc(fields, sizeof(mx classid));
it seems that the mxcalloc function can only be used in c.
is there a way to use it in the cpp extension as well?

回答 (1 件)

Angelo Yeo
Angelo Yeo 2023 年 11 月 16 日
The "phonebook.c" is composed of lots of C APIs for MATLAB (e.g., mxGetClassID), and you cannot change the extention to cpp to use it on the fly. You can find a cpp version of the "phonebook" example with the command below. Please find how it is different from the C version.
edit([matlabroot '/extern/examples/cpp_mex/phonebook.cpp'])

カテゴリ

Help Center および File ExchangeC Matrix API についてさらに検索

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by