estimate memory size in matlab
548 views (last 30 days)
Chetan Aswathanarayana on 18 Jun 2013
I' am not sure if we can do this currently without creating a variable. However if the variable is already in the workspace, then the below command would give the bytes allocated.
However you could type the below command, you would then know the maximum memory avaliable in your system
This is what I got on my PC:
Maximum possible array: 18848 MB (1.976e+10 bytes) *
Memory available for all arrays: 18848 MB (1.976e+10 bytes) *
Memory used by MATLAB: 1680 MB (1.761e+09 bytes)
Physical Memory (RAM): 12279 MB (1.288e+10 bytes)
Iain on 18 Jun 2013
The generic size of any variable is:
sum of (each element of the array * bytes in that element) + some overhead.
Normal arrays: Double, uint64 & int64 formats have 8 bytes per element. single, uint32 & int32 formats have 4 bytes per element. some character types, uint16 & int16 formats have 2 bytes per element. logical, most character types, uint8 & int8 formats have 1 byte per element. Overheads are "small" - I think this would be a few 10s of bytes for normal arrays.
Cell arrays and structures are much more detailed and have higher overheads.