Need help on Matlab memory error

Below is the error I got while using divagrid on Matlab. Anyone has a solution? How do I expand the available space? My computer has 16 GB of memory and it seems to be only using 1/3 of them at most.
Many thanks!
Total number of data constraint: ndata = 13743153
** ERROR - ALLODY - STORAGE OF kelos
REQUIRED SPACE27544606
AVAILABLE SPACE : 20000000
Index in position 2 exceeds array bounds.

3 个评论

can you post the whole code and the data it requires?
Matlab needs contiguous blocks of free memory to store variables, so if your free memory is very fragmented you won't be able to make large variables. If you search for them on this forum, you should be able to find tips on how to maximize your array sizes.
Thank you for the info! Any specifics on the solution? I'm unable to find any tips on how to solve this on this forum.

请先登录,再进行评论。

 采纳的回答

You need to adjust a parameter and recompile. See page 181 of the user guide.

6 个评论

Thank you very much! Unfortunately, that instruction is for the UNIX version of divagrid, instead of the Matlab version. Do you know how to fix that in the Matlab version?
The solution is what I posted above. What you are referring to as the "Matlab version" prepares data files and then uses system() to invoke diva.exe . The error message is coming from diva.exe so you need to make the source code change described on pages 180 to 181 and then rebuild diva.exe
Many thanks!
Sorry for not lack of knowledge on exe files, but would you mind to elaborate on how specifically to make the source code change described on pages 180 to 181 and then rebuild diva.exe?
The manuals says: "recompile the sources after reducing the values of parameters nrea and nent in file ./src/Fortran/Calc/divainc.h".
I have no idea how to access the divainc.h file in diva.exe.
You are looking on page 180 instead of page 181. The error you are getting is page 181 and for it you need to increase the values.
The compilation scripts they provide are configured more for Linux. It is possible to edit the files without great difficulty if you are accustomed to using gcc/gfortran and Make files. You would need something like MinGW installed.
Unfortunately, I do not know how to use gcc/gfortran and MinGW to edit exe files, but thank you very much anyway!
You would edit the .h file they indicate to change those two parameters; that would require a plain text editor.
More of a nuisance is that you would need to edit the Makefile (using a text editor) to reconfigure the locations of the include files and libraries and possibly to change the names of the compilers. It is not a big deal for someone who is accustomed to using those compilation tools, but it could certainly be somewhat baffling to someone who has not used those tools before.

请先登录,再进行评论。

更多回答(0 个)

产品

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by