# buffer

Buffers a signal vector into matrix

list <- buffer(x, n, p, opt, nodelay = FALSE)
X <- buffer(x, n, p, nodelay = TRUE) 

This function is used to buffer a signal vector into a matrix of data frames. If the input for nodelay is TRUE, the the signal is buffered with no delay. If nodelay is FALSE, and specifies a vector of samples to precede x[1] in an overlapping buffer.

Input var Description Units Default value
x The signal vector to be bufferedN/AN/A
n The desired length of data segments (rows).N/AN/A
p The desired amount of overlap between consecutive frames (columns) in the output matrixN/AN/A
opt The vector of samples specified to precede x[1] in an overlapping bufferN/AN/A
nodelay A logical statement to determine if the vector should be buffered with or without delay. Default is FALSE (with delay)LogicalFALSE
Output var Description Units
X A matrix of the buffered signal vector “vec” with “n” data segments and an overlap between consecutive frames specified by “p”. The matrix starts with “opt” values if nodelay is FALSE.N/A
z (if nodelay = FALSE) The remainder of the vector which was not included in the matrix if the last column did not have a full number of rows.N/A
opt(nodelay = FALSE) The last values, length of “p”, of the matrix “X”.N/A
x <- c(1:10)
n <- 3
p <- 2
opt <- c(2,1)
list1 <- buffer(x, n, p, opt)
X <- buffer(x, n, p nodelay = TRUE)