Extract multiple sub-samples of data from a vector or matrix.

[X,cues] = extract_cues(x,fs,cues,len) % Matlab & Octave
list <- extract_cues(x,fs,cues,len) #R

Extract multiple sub-samples of data from a vector or matrix.

Input var Description Units Default value
x is a vector or matrix of measurements. If x is a matrix, each column is treated as a separate measurement vector. N/A N/A
fs is the sampling rate of the data in x. Hz N/A
cues defines the start time in seconds of the intervals to be extracted from x. seconds N/A
len is the length of the interval to extract in seconds. This should be a scalar. seconds N/A
Output var Description Units
X is a matrix containing sub-samples of x. N/A
cues is the list of cues actually used. cues that require data outside of x are rejected. N/A
• Output sampling rate is the same as the input sampling rate.
• If x is a vector, X has as many columns as there are cues, i.e., each cue generates a column of X. If x is a pxm matrix, X will be a qxmxn matrix where n is the size of cues and q is the length of the interval requested, i.e., round(fs*len) samples.

### Matlab & Octave

The example below uses data from the file testset1.nc. You can download it from the animaltags website's example data sets. If the file is saved in your current working directory, load it via:

testset1 = load_nc(‘testset1.nc’)
[X,cues] = extract_cues(testset1.A.data, testset1.A.sampling_rate, 3, 10)

### R

The example below uses data from the file testset1.nc. You can download it from the animaltags website's example data sets. If the file is saved in your current working directory, load it via:

testset1 <- load_nc(‘testset1.nc’)
list <- extract_cues(x = testset1$A$data, fs = testset1$A$sampling_rate, cues = 3, len = 10)