Close all open files in matlab after error

Alec Jacobson

June 29, 2012

weblog/

I got a funny error running a matlab batch script:
/Applications/MATLAB_R2011b.app/toolbox/matlab/lang/message.m:
Too many files open.

Error in dlmread (line 62)
The solution was easy:
fclose('all')