MATLAB 陣列大小限制

Ammar Ali 2021年10月2日 2021年7月4日
MATLAB 陣列大小限制

本教程將討論如何使用 MATLAB 中的 memory 命令檢查記憶體限制和陣列的最大大小。

在 MATLAB 中使用 memory 命令檢查記憶體限制和陣列可能的最大大小

由於執行 MATLAB 的裝置的硬體限制,陣列的最大允許大小受到限制。例如,如果你的裝置有 8 GB 的實體記憶體,那麼最大可能的陣列大小將在 4 GB 左右,因為其餘的將由 windows 和 MATLAB 佔用。你始終可以使用 MATLAB 命令視窗中的 memory 命令檢查陣列的可用記憶體。例如,讓我們使用 8GB 記憶體的膝上型電腦檢查可用記憶體。請參考下面的程式碼和輸出。

>> memory
Maximum possible array:        4544 MB (4.765e+09 bytes) *
Memory available for all arrays:        4544 MB (4.765e+09 bytes) *
Memory used by MATLAB:        2499 MB (2.621e+09 bytes)
Physical Memory (RAM):        8071 MB (8.463e+09 bytes)

*  Limited by System Memory (physical + swap file) available.

在上面的程式碼中,你可以看到所有陣列可用的記憶體為 4544 MB,其餘的正在被 windows 和 MATLAB 使用。

Author: Ammar Ali
Ammar Ali avatar Ammar Ali avatar

Hello! I am Ammar Ali, a programmer here to learn from experience, people, and docs, and create interesting and useful programming content. I mostly create content about Python, Matlab, and Microcontrollers like Arduino and PIC.

LinkedIn Facebook