[SAC-HELP] bug fix in readsac.m (missing fclose)
Warren Caldwell
warrenc at stanford.edu
Mon Feb 14 16:05:59 PST 2011
Hi all,
I believe I've found a bug (unbalanced fopen/fclose) in readsac.m.
When I read in a large number of sac files in Matlab using F=readsac(*
list-of-files-tens-**long*), Matlab hangs and crashes. I fixed it in
sac-101.2/utils/readsac.m by adding an fclose statement as follows:
Original (first line is line 243):
if ~ismember(B(7), 1:6) % non-native byte order
[comp, mxsize, endian] = computer;
Changed:
if ~ismember(B(7), 1:6) % non-native byte order
*fclose(fid);* % close original 'fid' since we are about to create a
new 'fid'
[comp, mxsize, endian] = computer;
Without this fclose, Matlab opens each file without closing the previous
one. I had to make the same change in sac-101.4/utils/readsac.m.
Cheers,
Warren
--
~~~~~~~~~~~~~~~~~~~~~~~~~
Warren Caldwell
Stanford Geophysics
pangea.stanford.edu/~warrenc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.iris.washington.edu/pipermail/sac-help/attachments/20110214/f3654eac/attachment.html>
More information about the sac-help
mailing list