MATLAB: How to increase Memory

out of memory

Dear friends
I used a "for" loop in my M.file codes and I used "fopen" and "fclose" functions in "for" loop.
After 508 iterations, MATLAB has been stopped and following message showed:
"??? Error using ==> fprintf
Invalid file identifier. Use fopen to generate a valid file identifier."
I think, MATLAB faced Low memory problem because by closing software and starting again MATLAB can continue to remain iterations. Therfore I need to a function to increase MATLAB memory. The "clear all" is not useful.
Regards

Best Answer

You aren't using the same filename are you? So that it might be a timing issue. Try adding a pause(0.1). Another shot in the dark: try fclose('all').
Related Question