PO_matlab
center_slice.m File Reference

Extracts a centered window of specified length from a vector. More...

Functions

function center_slice (in v, in k)

Detailed Description

Extracts a centered window of specified length from a vector.

This function returns a subvector of length k, centered around the middle of the input vector v. If k is larger than the length of v, an error is raised. If the window would exceed the vector bounds, it is clamped appropriately.

Parameters
vInput vector
kDesired window length (must be less than or equal to length(v))
Return values
cOutput vector of length k centered within v

Function Documentation

◆ center_slice()

function center_slice ( in v,
in k )