MATLAB function to process vector with sliding window function, return matrix of vector responses
问题 Assuming vector v of size 1 x n and function fun that takes in a vector of length L and returns a vector of size p x 1 . Is there a MATLAB function that would take in vector v , process each sliding window of length L with function fun, and return a matrix of size p x n (or p x (n-L) ). I am aware this could be achieved with creating a matrix of windowed vectors with im2col and processing each of those, but this takes too much memory for a long vector v . 回答1: funsl=@(is) fun(v(is:is+l-1));