Maximum array size in MATLAB?

前端 未结 4 873
-上瘾入骨i
-上瘾入骨i 2021-01-02 22:15

I\'m writing a MATLAB program that will generate a matrix with 1 million rows and an unknown amount of columns (at max 1 million).

I tried pre-allocating this matrix

4条回答
  •  时光取名叫无心
    2021-01-02 22:28

    In older versions of Matlab that don't include the memory command, you can use:

    feature memstats

    Physical Memory (RAM):
        In Use:                              738 MB (2e2c3000)
        Free:                                273 MB (11102000)
        Total:                              1011 MB (3f3c5000)
    Page File (Swap space):
        In Use:                             1321 MB (529a4000)
        Free:                               1105 MB (45169000)
        Total:                              2427 MB (97b0d000)
    Virtual Memory (Address Space):
        In Use:                              887 MB (37723000)
        Free:                               1160 MB (488bd000)
        Total:                              2047 MB (7ffe0000)
    Largest Contiguous Free Blocks:
         1. [at 4986b000]                    197 MB ( c585000)
         2. [at 3e1b9000]                    178 MB ( b2a7000)
         3. [at 1f5a0000]                    104 MB ( 6800000)
         4. [at 56032000]                     77 MB ( 4d3e000)
         5. [at 68b40000]                     70 MB ( 4660000)
         6. [at 3a320000]                     54 MB ( 3610000)
         7. [at 63568000]                     45 MB ( 2d48000)
         8. [at 35aff000]                     40 MB ( 2821000)
         9. [at 60f86000]                     37 MB ( 25ca000)
        10. [at 6f49d000]                     37 MB ( 25b3000)
                                            ======= ==========
                                             842 MB (34ac0000)
    
    ans =
    
       207114240
    

    You can't suppress the output, but it returns the largest memory block available ( 207,114,240 Bytes / 8 = 25,889,280 doubles )

提交回复
热议问题