Matrix Size Limit in MATLAB

Possible duplicate:
MATLAB: maximum pre-allocated size?

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

+6
source share
2 answers

The memory in Matlab is limited only by the amount of memory (including virtual memory) available to it by the operating system. Matrices are stored in memory as contiguous space, so if you have a matrix that will occupy 8 GB of memory, you will need one large piece of 8 GB for you in 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 instance:

 > 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. 

To calculate the size of an array that matches the Maximum possible array value, you simply divide by the number of bytes needed for each element of the array. In the memory documentation:

Maximum possible array

The maximum possible array is the size of the largest contiguous block of free memory. Thus, this is the upper bound of the largest array that MATLAB can create at this time.

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 

To find out how many array elements this number is, divide by the number of bytes in the array class. For example, for a double array, divide by 8. The actual number of elements created by MATLAB is always less than this number.

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

+5
source

Yes, you are limited by the amount of RAM available on your computer. You can check this in MATLAB with the command

 feature( 'memstats' ) 
+1
source

Source: https://habr.com/ru/post/896757/


All Articles