Why is mxCreateNumericMatrix maximum size smaller than system maximum array size?
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Daniel
 el 10 de Oct. de 2013
  
    
    
    
    
    Respondida: Daniel
 el 10 de Oct. de 2013
            Hi,
I am trying to create a matrix in a MEX function. The following works:
   uint64_t N;
   N = 2147483647; // N = 2*2^30 -1
   plhs[0] = mxCreateNumericMatrix(N,1,MXUINT8_CLASS,mxREAL);
However, I am unable to create an array that is this size:
   uint64_t N;
   N = 2147483648; // N = 2*2^30
   plhs[0] = mxCreateNumericMatrix(N,1,MXUINT8_CLASS,mxREAL);
The preceding code throws the error:
    maximum variable size allowed by the function exceeded
Which is confusing since my system (64-bit Linux running 64-bit Matlab 2010b) tells me the maximum array size is, in fact, very large.
    [~,M] = computer
    M = 
        281474976710655 % 2^48 -1 for those of you keeping track
Furthermore, from the command line, I am able to create very large arrays, and have been quite happily for some time, with calls like the following:
    a = zeros(16*2^30,1,'uint8');
    disp(uint64(numel(a)))
    17179869184
My question is, why am I not able to create arrays in my mex function that I am clearly able to create from the command line, or from other *.m functions?
Thank you.
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
				Más información sobre Matrix Indexing en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
