MATLAB中的矩阵大小限制 [英] Matrix size limitation in MATLAB

查看:1425
本文介绍了MATLAB中的矩阵大小限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
MATLAB:最大的预分配大小?

Possible Duplicate:
MATLAB: maximum pre-allocated size?

在MATLAB中创建矩阵是否有大小限制?如果是这样,我在哪里可以找到这些信息?

Is there a size limitation on creating a matrix in MATLAB? If so, where can I locate this information?

推荐答案

Matlab中的内存仅受操作系统为其提供的内存量(包括虚拟内存)限制.矩阵作为连续空间存储在内存中,因此,如果您有一个占用8GB内存的矩阵,则需要8GB的一大块内存.

Memory is limited in Matlab only by the amount of memory (including virtual memory) made available to it by the operating system. Matrices are stored in memory as contiguous space, so if you have a matrix that would occupy 8GB of memory, you would need one big chunk of 8GB to be available to you in memory.

您可以使用 memory 命令来提供有关可用于以下目的的内存的详细统计信息:您,包括单个矩阵可用的连续内存量.例如:

You can use the memory command to provide detailed statistics about the memory available to you, including the amount of contiguous memory available for a single matrix. For example:

> memory

Maximum possible array:           677 MB (7.101e+008 bytes) *
Memory available for all arrays: 1601 MB (1.679e+009 bytes) **
Memory used by MATLAB:            446 MB (4.681e+008 bytes)
Physical Memory (RAM):           3327 MB (3.489e+009 bytes)

  *  Limited by contiguous virtual address space available.
  ** Limited by virtual address space available.

要计算Maximum possible array值所对应的数组大小,只需除以每个数组元素所需的字节数即可.从 memory 文档:

To calculate the array size that the Maximum possible array value corresponds to, you simply divide by the number of bytes required by each array elements. From the memory documentation:

最大可能数组

最大可能数组是最大连续空闲内存块的大小.因此,这是MATLAB目前可以创建的最大单个数组的上限.

Maximum Possible Array is the size of the largest contiguous free memory block. As such, it is an upper bound on the largest single array MATLAB can create at this time.

MATLAB从以下两个值中较小的一个得出该数字:

MATLAB derives this number from the smaller of the following two values:

* The largest contiguous memory block found in the MATLAB virtual address space
* The total available system memory

要查看此数字表示多少个数组元素,请除以数组类中的字节数.例如,对于双精度数组,将其除以8.MATLAB可以创建的实际元素数量始终少于该数量.

To see how many array elements this number represents, divide by the number of bytes in the array class. For example, for a double array, divide by 8. The actual number of elements MATLAB can create is always fewer than this number.

Mathworks还提供了有关如何避免Out of Memory错误的详细文档,此处.

Mathworks also provides detailed documentation on how to avoid Out of Memory errors here.

这篇关于MATLAB中的矩阵大小限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆