5.0

5.0 | 2 ratings Rate this file 18 downloads (last 30 days) File Size: 11.74 KB File ID: #5546

sacsun2mat

by Frederik Tilmann

 

23 Jul 2004 (Updated 27 Jul 2004)

No BSD License  

Read SAC files directly into MATLAB data structures.

Download Now | Watch this File

File Information
Description

[SACdata,SeisData,filenames]=SACSUNMAT('file1','file2',...,'filen')

reads n SAC files file1, file2, filen with SUN byte order and converts them to MATLAB format. The filenames can contain globbing characters (e.g. * and ?). These are expanded and all matching files loaded.

SACSUNMAT( cellarray ) where cellarray={'file1','file2',...,'filen'} is equivalent to the standard form.

SACdata is an nx1 struct array containing the header variables in the same format as is obtained by using MAT function of SAC2000. SACdata(i).trcLen contains the number of samples.

SeisData is an mxn array (where m=max(npts1, npts2,...)) containing the actual data.

filenames is a nx1 string cell array with the filenames actually read.

Note that writing

 [SACdata,SeisData]=sacsun2mat('file1','file2',...,'filen')

is equivalent to the following sequence

sac2000
READ file1 file2 .. filen
MAT
(in fact the failure of above sequence to work properly on my system motivated this script).

SACSUN2MAT was written by F Tilmann (tilmann@esc.cam.ac.uk) based on sac_sun2pc_mat by C. D. Saragiotis (I copied the routines doing the actual work from this code but used a different header structure and made the routine flexible). It was tested on MATLAB5 on a PC but should work on newer versions, too.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
SAC_Sun2PC_mat

MATLAB release MATLAB 5.3 (R11)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
04 Apr 2007 Cy Webster  
11 Aug 2008 SEPIDEH RASTIN

It was nice just one thing and it s the " out of memory error" when input is a large size .SAC file.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
sac Frederik Tilmann 22 Oct 2008 07:28:10
conversion Frederik Tilmann 22 Oct 2008 07:28:10
seismic Frederik Tilmann 22 Oct 2008 07:28:10
earth sciences Frederik Tilmann 22 Oct 2008 07:28:10
general Frederik Tilmann 22 Oct 2008 07:28:10
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com