Error: File is too large for MATLAB to run.

55 views (last 30 days)
Hi all,
After opening a large .m file (140MB), I tried to run it.
I receive the following error:
Error: File is too large for MATLAB to run.
What can I do to resolve this error?

Accepted Answer

Walter Roberson
Walter Roberson on 18 Dec 2019
Starting in R2019b, program files larger than approximately 128 MB do not open or run. For files that contain only code (for example, .m and .p files), this limit affects the file size. For files that store more than just code (for example, .mlx files), it affects the size of the code. Running statements larger than 128 MB, either directly in the Command Window or using the eval function, also is not supported. In addition, code with high levels of complexity, such as a large number of deeply nested if statements, is not supported.
Large program file or statement sizes could result in unpredictable behavior and often occurred when using large portions of code (for example, over 500 lines) to define variables with constant values. To decrease the size of program files, consider defining the variables and saving them in a data file (for example, a MAT-file or .csv file). Then you can load the variables instead of executing code to generate them. This adjustment not only decreases the file size of your program but also can increase performance.
  5 Comments
Vitor Manuel Ribeiro
Vitor Manuel Ribeiro on 28 Jul 2022
I am curently having similar issue reported by corentin gut. I have a large symbolic expressions that i previously saved to m files (but not using matlabFunction since i run into memory issues), using fopen and fprintf functions. However unfortunately i run into the problem "File is too large for MATLAB to run."
Any way to go around this? I guess that if i use simplify i will have simpler and shorter expressions but it will consume many time.
Regards,

Sign in to comment.

More Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!