|
any2matlab.cc
|
This es a MEX-file using Thomas Forbriger's datrwxx library importing seismic dataformats to MATLAB. More...
#include <iostream>#include <fstream>#include <sstream>#include <cstdio>#include <ctype.h>#include <cstring>#include <string>#include <algorithm>#include <vector>#include <datrwxx/readany.h>#include <libtime++.h>#include <aff/series.h>#include <gsexx.h>#include <sffxx.h>#include "mex.h"Go to the source code of this file.
Functions | |
| void | mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) |
| mexFunction of any2matlab to read seismic data to MATLAB More... | |
This es a MEX-file using Thomas Forbriger's datrwxx library importing seismic dataformats to MATLAB.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software
REVISIONS and CHANGES
The gateway routine to every MEX-file is called mexFunction.
| nrhs | Number of inputs (Right Hand Side) |
| prhs | Array of pointers to input data. |
The input data is read-only and should not be altered by your mexFunction .
The variables nrhs and nlhs are the number of variables that MATLAB requested at this instance. They are analogous to NARGIN and NARGOUT in MATLAB.
The variables prhs and plhs are not mxArrays. They are arrays of pointers to mxArrays. So if a function is given three inputs, prhs will be an array of three pointers to the mxArrays that contain the data passed in. The variable prhs is declared as const. This means that the values that are passed into the MEX-file should not be altered. Doing so can cause segmentation violations in MATLAB. The values in plhs are invalid when the MEX-file begins. The mxArrays they point to must be explicitly created before they are used. Compilers will not catch this issue, but it will cause incorrect results or segmentation violations.
tfstruct = any2matlab('name.ftype'); or:
tfstruct = any2matlab('name', 'ftype'); or:
tfstruct = any2matlab('name', 'ftype', 'dtype');
name is the filename of the datafile. A "." seperates name from ftype e.g. data.sff name is the filename of the datafile in an arbitrary form. ftype is one of the options below.name is the filename of the datafile in an arbitrary form. ftype is one of the options below. dtype is the type the data will be imported.dtype is one of the following two optionsint for less memory usedouble as defaultftype is one the file types ID as used in libdatrwxxtfstruct is a MATLAB struct with the following fields:date: date of first sample. format: 'YYYY/MM/DD' time: time of the first sample. format: 'hh:mm:ss.milsec' tdate: timevector: [YYYY MM DD hh mm ss.milsec]station: Station code. type: string channel: FDSN channel code. type: string auxid: Auxiliary identification code. type: string samps: Number of samples. type: int dt: Sampling interval (sec). type: double calib: Calibration factor. type: double calper: Calibration reference period. type: double instype: Instrument type. type: string trace: [sampsx1 double] or [sampsx1 int]For further information watch sff::WID2
To allocate sufficient memory any2matlab has to open a first time the desired datafile to get the number of traces and the number of samps per trace.
While opening the datafile a second time any2matlab will read one trace and write it immediately to tfstruct until there are no traces left.
With this method you are able to read as much traces as fit to your machines memory.
Definition in file any2matlab.cc.
| void mexFunction | ( | int | nlhs, |
| mxArray * | plhs[], | ||
| int | nrhs, | ||
| const mxArray * | prhs[] | ||
| ) |
mexFunction of any2matlab to read seismic data to MATLAB
| nlhs | number of return arguments |
| plhs | the return arguments |
| nrhs | number of input arguments |
| prhs | the input arguments |
Definition at line 129 of file any2matlab.cc.
1.8.14