[SAC-HELP] bug fix in readsac.m (missing fclose)

Brian Savage savage at uri.edu
Wed Feb 16 07:18:17 PST 2011


Warren,

Thank you for the fix.  We will be including this in the upcoming  
101.5 version.

Brian Savage
savage at uri.edu

On Feb 14, 2011, at  7:05 PM , Warren Caldwell wrote:

> 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
>
> _______________________________________________
> sac-help mailing list
> sac-help at iris.washington.edu
> http://www.iris.washington.edu/mailman/listinfo/sac-help




More information about the sac-help mailing list