Matlab crashes with large matrix
古いコメントを表示
I need to create a large matrix F=[F1, F2, ... , FN] where each Fn has the same number of rows (about 12,000) but different number of columns. What I am doing now is to create F as a cell array using a loop with element F{n} = Fn. The problem is that when the number of columns of F is very large, Matlab crashes: at some point it shuts down (I run this on a server, and I find matlab closed). I suspect that it shuts down when I convert the cell array into a single matrix, F=cell2mat(F);
Notice that everything works ok when F has a number of columns less than say, say 1,000,000,
Any help is much appreciated. Thanks!
採用された回答
その他の回答 (1 件)
Bruno Luong
2023 年 10 月 25 日
編集済み: Bruno Luong
2023 年 10 月 25 日
For 1e6 column the memory required in Gb for one array is
memgGb = 1e6*12e3*8 / 1e9
And you have the cell array + the concatenate array (single contiguous emory blockà, so you need 192 Gb of free memory.
You might consider using single-class array, write directly to the allocated matrix as Walter suggests or using tall array assuming you store the transposed of the original intended array.
2 件のコメント
valentino dardanoni
2023 年 10 月 25 日
Bruno Luong
2023 年 10 月 25 日
licols is Matt's FEX, but yeah I quite participate to popular the idea. Thanks
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!