5.0

5.0 | 3 ratings Rate this file 8 Downloads (last 30 days) File Size: 11.74 KB File ID: #5546

sacsun2mat

by Frederik Tilmann

 

23 Jul 2004 (Updated 27 Jul 2004)

Read SAC files directly into MATLAB data structures.

| 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 (3)
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.

21 Jul 2010 nadav wetzler  
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

Contact us at files@mathworks.com