Effacer les filtres
Effacer les filtres

Mex: out of memory mxCreateNumericArray

3 vues (au cours des 30 derniers jours)
mick strife
mick strife le 22 Avr 2013
Hello,
i m getting an error "out of memory" when i m declaring an large array. but when i m declaring an small array it works. Unfortunately i m beginner in mex. Can someone tell pls how i can solve this problem? Many many thanks!
// works
int dim[3] = {400,3,1000};
plhs[0] = mxCreateNumericArray(3, dim, mxDOUBLE_CLASS, mxREAL);
// doesnt work
int dim[3] = {4000,3,10000};
plhs[0] = mxCreateNumericArray(3, dim, mxDOUBLE_CLASS, mxREAL);

Réponse acceptée

Friedrich
Friedrich le 22 Avr 2013
Hi,
that works fine for me. I assume you use a 32bit MATLAB? The variable you create needs 960mb of memory in one piece which is most likely not available for you.
You can use the memory command (Windows only!) to see what the biggest matrix is you can allocate.
Small advice: Don't use an int for the dimensions. Use mwSize. This is a bittedness independent type.

Plus de réponses (0)

Catégories

En savoir plus sur Write C Functions Callable from MATLAB (MEX Files) dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by