Wednesday, September 26, 2007

r41 too many open files

r41 | ozzloy | 2007-09-12 22:36:44 -0700 (Wed, 12 Sep 2007) | 3 lines

currently works for a small number of plots before dying.

oh i hate matlab again. there is some sort of "too many open files" error that is keeping me from using the picture grabbing function i just wrote. i worked out a couple different solutions to this:
the first is to open 1 out of 10 files that i was opening before. this actually made things go quite quickly. unfortunately it wasn't a real solution. the open file count would still max out and cause matlab to crash. at this point i would still have to restart matlab and re-initialize many variables.
i called mathworks and left a message detailing my problem. the next day i got a call back. we discussed the problem and he told me about a way to close all files. i put "fclose('all');" into the place of my code just after where i might have open files. this worked, but it also leads me to believe that the problem is not in my code, but in one of the functions i call, "imread(image_location)". i told the mathworks guy about this and he said he'd look into it. this 'solution' closes all files. that's not exactly what i want to do. right now it seems to be ok. however i can imagine a situation in which i would call this code and it would close all files, causing problems because i can't figure out why my files are closing. basically it's a problem for future users of this code.

No comments: