Cpp to Mex conversion

14 ビュー (過去 30 日間)
How can I do a cpp conversion to mex?
  1 件のコメント
James Tursa
James Tursa 2019 年 6 月 17 日
Please post more details. Have you looked at the examples in the doc?



James Tursa
James Tursa 2019 年 6 月 18 日
Looks like you have a mismatch with variable types, probably an older piece of code that you are trying to compile on a newer MATLAB version. E.g., the code probably has this definition:
const int *DimsBness;
when it should be this:
const mwSize *DimsBness;
And you probably have something like this:
const int *dims;
or this
int dims[] = {2,3}; /* or whatever */
when it should be this:
const mwSize *dims;
or this
mwSize dims[] = {2,3}; /* or whatever */
Simply update the code with the required types to fix these errors.
  3 件のコメント
Stelios Fanourakis
Stelios Fanourakis 2019 年 6 月 20 日
I used this command to create the .mexmaci64
mex -compatibleArrayDims BoneSegmentationDP.cpp
I tried to call it but I get the error of "Not correct or not enough input arguments".
I cannot open to edit this .mexmaci64. I cannot find any other function in the files to call it so to know how many inputs and what inputs it requires.
I also attach both cpp and .mexmaci64 so you tell me what am I doing wrong. Can you open .mexmaci64? Can you tell me its inputs?


その他の回答 (1 件)

Suryaansh Mata
Suryaansh Mata 2019 年 6 月 18 日
You can use the inbuilt MEX functionality to make use of the source code in C/C++ in MATLAB. Follow the step-by-step detailed instructions given at https://www.mathworks.com/help/matlab/matlab_external/standalone-example.html for the same.
  2 件のコメント
Maria Cristina Bustos Rodriguez
Maria Cristina Bustos Rodriguez 2020 年 1 月 31 日
I solved that mxCreateNumericArray_730 error by putting this warning:
"mex -DMX_COMPAT_32 yourcode.cpp "


Community Treasure Hunt

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

Start Hunting!

Translated by