Data Array (data): A cell array where each cell contains a one-dimensional array (vector) of numeric data.
Onsets (onsets): A cell array where each cell contains a one-dimensional vector representing an index of the first value for each each segment.
Segment Length (segment_length): An integer specifying the length (number of data points) of all segments to be extracted.
Missing values (missing): A cell array where each cell contains a one-dimensional vector representing a logical index of whether data points are considered missing or not. Each cell in 'missing' must have the same length as the corresponding cell in 'data'.
The cell arrays 1, 2, 4 must have the same size.
Process
Missing data handling: for each cell of data, set all data points in the vector that are indexed in missing to NaN.
Segment Extraction:
Extract segments, the first element of each segment is indexed by onsets, and extracting a vector of the specified length.
Segments may overlap.
If a segment extends beyond the end of the data vector, fill the remaining part with NaNs to maintain the specified segment_length.
Output
Segments (segments): A matrix containing all the segments. Each row in the matrix represents a segment extracted from the data. All segments are of uniform length as specified by segment_length.
Session index ('sessions'): an index vector specifying for each row of segments from which cell of the input data the segment was extracted.
Additional Notes
Overlapping segments are permitted and will be processed appropriately.
Padding segments with NaNs at the end of the data vectors maintains consistency in cases where the dataset's length is insufficient.
Feature Description
Inputs
data
): A cell array where each cell contains a one-dimensional array (vector) of numeric data.onsets
): A cell array where each cell contains a one-dimensional vector representing an index of the first value for each each segment.segment_length
): An integer specifying the length (number of data points) of all segments to be extracted.missing
): A cell array where each cell contains a one-dimensional vector representing a logical index of whether data points are considered missing or not. Each cell in 'missing' must have the same length as the corresponding cell in 'data'.The cell arrays 1, 2, 4 must have the same size.
Process
data
, set all data points in the vector that are indexed inmissing
to NaN.onsets
, and extracting a vector of the specified length.segment_length
.Output
segments
): A matrix containing all the segments. Each row in the matrix represents a segment extracted from the data. All segments are of uniform length as specified bysegment_length
.segments
from which cell of the input data the segment was extracted.Additional Notes