How do I specify my ..

From BRTT

Jump to: navigation, search


Question
Question:

How do I specify my own join keys when using the Matlab dbjoin command?

Answer:

The dbjoin command in the Antelope Toolbox for Matlab, like the dbjoin commands in the other language interfaces, will by default infer the natural join keys for the two specified views. However, sometimes it is necessary to override those natural keys if they are not doing what you intend. Often this occurs in complex join situations.


The usage line for dbjoin in Matlab is as follows:

Contents

See also

</noinclude> The square brackets indicate optional arguments. Thus, given two views db1 and db2, the natural join may be constructed with

See also

</noinclude> To join these two on the field 'sta', one can use

See also

</noinclude> To join these two such that the 'time' field of the first view falls within the range specified by 'time' and 'endtime' in the second view, we can write

See also

</noinclude> Finally, to specify multiple join keys, we learn from the documentation for the Matlab dbjoin (obtained by typing "help dbjoin" at the Matlab prompt) that:

See also

</noinclude> A review of the matlab manuals shows that cell-arrays of strings may be constructed by putting the individual strings inside squiggly brackets. We will show this using the advanced example below. In this example, a join of site and origin is made, so that we will eventually be able to use the sarrival() function from the dbexpression calculator (see the man page for dbexpressions in section 5 of the unix man pages for more detail). Then we will 'cheat' and make sure it is subsetted for the one hypocenter for which we actually have waveforms. Finally, we will use dbjoin to create a view containing all waveforms for which we have data overlapping the expected S-arrival for a given station:

See also

</noinclude> Running this produces:

See also

</noinclude>