Cpp to Mex conversion
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Stelios Fanourakis
le 17 Juin 2019
Commenté : Maria Cristina Bustos Rodriguez
le 31 Jan 2020
How can I do a cpp conversion to mex?
Thanks
1 commentaire
Réponse acceptée
James Tursa
le 18 Juin 2019
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 commentaires
James Tursa
le 19 Juin 2019
Modifié(e) : James Tursa
le 19 Juin 2019
Please show the command you are using to compile the mex routine. And then show how you are trying to call the mex routine. Mex routines can be called just like any other regular function by using the function name and an argument list.
Plus de réponses (1)
Suryaansh Mata
le 18 Juin 2019
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 commentaires
Maria Cristina Bustos Rodriguez
le 31 Jan 2020
I solved that mxCreateNumericArray_730 error by putting this warning:
"mex -DMX_COMPAT_32 yourcode.cpp "
Voir également
Catégories
En savoir plus sur Write C Functions Callable from MATLAB (MEX Files) dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!