ARRY EXEEDS RANDOM NUMBER
Show older comments
hi i receive this message in matlab when i run a monte carlo probllem
Requested 1000000x10000 (74.5GB) array exceeds maximum array
size preference. Creation of arrays greater than this limit
may take a long time and cause MATLAB to become
unresponsive. See array size limit or preference panel for
more information.
Error in Z12R2the (line 14)
y=0.5.*(yv-yh)+0.5.*(yv+yh).*cos(2.*PSI);
Error in impedance_antennaR_new_2d (line 82)
fn=Z12R2the(r,PSI);
i can change this preference? i want to run the MC with 1e6 randon mumbers
thank you
George
2 Comments
David Hill
on 18 Aug 2021
There are various ways around a size limit. Why not loop through a number of times? Additional code would be helpful to make suggestions.
george veropoulos
on 19 Aug 2021
Accepted Answer
More Answers (1)
Jan
on 19 Aug 2021
0 votes
If you request 74.5GB of RAM for a matrix, care for having this size of memory plus some head room. On a 160 GB RAM machine, the code will run.
Did you follow the advice in the error message already:
See array size limit or preference panel for more information.
?
5 Comments
george veropoulos
on 19 Aug 2021
Walter Roberson
on 19 Aug 2021
Preferences -> MATLAB -> Workspace -> Limit the maximum array size to a percentage of RAM (untick this and Save the change)
If you are using Windows 10 (or any Windows) you will also need to configure larger page files; see https://www.thewindowsclub.com/increase-page-file-size-virtual-memory-windows
Your particular code will require at least twice as much temporary memory as the largest sustained array, so if your code is currently complaining that it cannot create a 75 gigabyte array, then you must configure your swap space to at least 150 gigabytes.
I find one page from 2018 that claims that the limit on Windows 10 is 4 times the amount of physical RAM you have, but that might have been the limit for an older version of Windows.
WARNING
Using that much swap memory on your system will be very 👏🏻 very 👏🏻 very 👏🏻 slow. For days. Maybe weeks.
So slow that any given keystroke you type might take half an hour to be registered by the computer.
george veropoulos
on 19 Aug 2021
Walter Roberson
on 19 Aug 2021
Divide the run up into batches that each fit into memory, and accumulate statistics as necessary.
george veropoulos
on 19 Aug 2021
Categories
Find more on Software Development Tools in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!