What is the largest number of rows of a matrix that Matlab can handle?

17 visualizaciones (últimos 30 días)
What is the largest number of rows of a matrix that Matlab can handle? How can one know that limit in my PC?
  4 comentarios
alpedhuez
alpedhuez el 28 de Jul. de 2020
I have posted the answer by myself above.

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 28 de Jul. de 2020
2^45-1 rows is the limit for MATLAB arrays.

Más respuestas (1)

Steven Lord
Steven Lord el 29 de Jul. de 2020
The theoretical limit is the number returned as the second output of the computer function.
The practical limit is based on how much memory you have on your system, as it's highly unlikely you have a machine capable of creating a matrix large enough to approach the theoretical limit (unless it's a sparse tall but thin matrix.)
>> x = sparse(2^48-1, 1, 1)
x =
(281474976710655,1) 1
>> x = sparse(2^48, 1, 1)
Error using sparse
Index into matrix is too large.
In 32-bit releases of MATLAB, it was much easier to reach the theoretical limit.
  3 comentarios
Steven Lord
Steven Lord el 29 de Jul. de 2020
>> [comptype, maxsize] = computer
comptype =
'PCWIN64'
maxsize =
281474976710655
The sparse x I created has exactly maxsize rows.
If you tried to create an array with an extremely large number of dimensions then yes, you'd consume a lot of memory with the size vector. In this example z only has two elements but it takes a little while to create.
x = [ones(1, 1e8), 2];
z = ones(x);
whos z
Bruno Luong
Bruno Luong el 29 de Jul. de 2020
Editada: Bruno Luong el 29 de Jul. de 2020
That's interesting. I believe some older MATLAB release the limits is about 2^32 (not a lot) even for 64-bits PC. Not sure if it's a limits of conception or internal overflow bug. Glad to see TMW push this boundary further away. I might revisit my test to see if the issue I found earlier is indeed solved.

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by