Filter löschen
Filter löschen

Mex: out of memory mxCreateNumericArray

3 Ansichten (letzte 30 Tage)
mick strife
mick strife am 22 Apr. 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);

Akzeptierte Antwort

Friedrich
Friedrich am 22 Apr. 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.

Weitere Antworten (0)

Kategorien

Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by