samer@3: % window - Window a sequnce of arrays in a given dimension samer@3: % samer@3: % window :: seq [[N,M]] -> seq [[N]]. samer@3: % window :: seq [[N,M]], L:natural -> seq [[N,L]]. samer@3: % window :: seq [[N,M]], L:natural, natural ~'hop size' -> seq [[N,L]]. samer@3: % samer@3: % This is just short for windowdata(...) samer@3: % Possible optimisation: samer@3: % when the span and hop are much less than the input buffer size samer@3: % and the source data does not have an efficient extract method, samer@3: % then it is worth caching the source data, ie window(cache(x),...) samer@36: function Y=window(X,varargin), samer@36: if nargin>1, Y=seq.windower.make(X,varargin{:}); samer@36: else samer@36: dim=length(size(X)); samer@36: if isseq(X), Y=concat(map(@(x)slices(x,dim),X)); samer@36: else Y=slices(X,dim); samer@36: end samer@36: end