What is the largest number of rows of a matrix that Matlab can handle?
19 ビュー (過去 30 日間)
古いコメントを表示
What is the largest number of rows of a matrix that Matlab can handle? How can one know that limit in my PC?
4 件のコメント
採用された回答
その他の回答 (1 件)
Steven Lord
2020 年 7 月 29 日
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 件のコメント
Steven Lord
2020 年 7 月 29 日
>> [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
2020 年 7 月 29 日
編集済み: Bruno Luong
2020 年 7 月 29 日
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.
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!