File Exchange

image thumbnail

RDSAC and MKSAC: read and write SAC seismic data file

version 1.4.0.0 (247 KB) by François Beauducel
Imports/plots and exports seismic data file in the IRIS/SAC format.

9 Downloads

Updated 11 Aug 2016

View Version History

GitHub view license on GitHub

Matlab codes to read and write SAC seismic data file

Cite As

François Beauducel (2020). RDSAC and MKSAC: read and write SAC seismic data file (https://github.com/IPGP/sac-matlab), GitHub. Retrieved .

Comments and Ratings (24)

François Beauducel

Thanks Alara. To get values as arrays you just have to add an output parameter in the command window:
>> X=rdsac('your_file');
and you will get time vector in X.t and data vector in X.d

Alara Ocak

Thanks for the code, it works perfect. But i need the t and acc values to get the response spectrum of records that code has extracted. Could you possibly explain how can i get t and d valueas as an array?

Randall Plate

François Beauducel

Thanks Randall. In fact this behaviour was not implemented! Sorry for that and please download the updated version.

Randall Plate

I am using MKSAC and passing in a data vector as well as a time vector. The comments in the header state that delta should be set automatically based on median of time differences between samples. However, it does not do this. It leaves it as the default value of 1.

Hongyi Su

QIMING ZHOU

alaa alaa

alaajafarbaqe@rgmail.com

Mitchell Spangler

Gowthami Bandlamudi

Aditya Khare

I can't get the function to plot my SAC file. I made a new script and wrote x =rdsac(). This opens a browser window and when I click on the SAC file I want to plot and hit 'Select', I get errors on line 223 and line 92. Has someone encountered similar problem?

Ghilman Al Fatih

Thanks mate

TideMan

There is a coding error in Line 92, it should read: [H,t0] = readheader(fid,varargin);
not:
readheader(fid);

Atin Nur Aulia

Bo KE

It is helpful for me.

Irfan Aufa

Kadek Palgunadi

François Beauducel

Thanks Rall for your feedback. This is a good idea to optimize the memory after importing data. Probably the best thing is to let the user adding himself the double() function, if he wants to make extensive signal processing (which is not compatible with all classes).

Rall Walsh

Thanks for this, definitely a great utility! I really appreciate it.

As it stands, it is extremely memory intensive. Loading in a .sac file that is less than 3 KB balloons up to over 10x original size.

I added an option (inelegantly) to not store the time as a double vector, and prevent the float32's from converting to doubles. I am sure others with moderately large datasets would also appreciate this option.

Rall Walsh

Petr Kolar

Exactly what one expect - thanks.

bold baatar

it is need to me.

umairia malik

Does anybody knows how to make changes in boundary conditions in mFD2D using crewes package. also what is the output for each hidden file in mFD2D. how can i learn?

AHMET ANIL DINDAR

Is it possible to convert SAC file to acceleration time history file? As a civil engineer, I have no idea what count is.

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!