MEXCallMatlab very slow. Suggest alternate

Hi, I am working on a MEX file. I am using MEXCallMatlab which is very slow to call matlab inbuilt function as well as user defined function. It is not possible for me to make mex for other files since they are in large number and each of them is calling many in-built. Thanks.

 Réponse acceptée

Jan
Jan le 30 Nov 2012

0 votes

mexCallMATLAB is slow. Calling built-in Matlab functions from a MEX is no good idea.

4 commentaires

Harshit
Harshit le 17 Déc 2012
Ok any idea about how should I proceed. I have too many functions to write script for.
James Tursa
James Tursa le 17 Déc 2012
Are you copying a lot of data into and out of the arguments? I.e., are you doing things that slow the mexCallMATLAB calls down?
Harshit
Harshit le 4 Avr 2013
Yes James. It is what happening.
Jan
Jan le 4 Avr 2013
When the main time is spent for the callimng of Matlab from inside the MEX function, and you need to call a lot of Matlab functions which call other builtins again, using a MEX-file is not an efficient approach. E.g. the creation of a usual GUI is not noticably faster when it is created as MEX function, because the creation of the UI-elements needs most of the time.
Therefore a good strategy is to find the bottlenecks of your program at first and use MEX files only for "basic" calculations.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Write C Functions Callable from MATLAB (MEX Files) dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by