I have try-catch in my code, when I catch the error, I write the error information to a file, but it always override the previous error information, how to do to avoid this problem? I want to append the next error information to the previous error information.
for p=3:10 ... Day = fdname(p).name; try ... catch fid = fopen('output-2016.err', 'wt'); fprintf(fid, 'Inconsistent data in %s, skipped.\n', p); fprintf(fid, 'Inconsistent data in %s, skipped.\n', Day); fclose(fid); end
Best Answer