How do I apply a sliding window on an array??

2 views (last 30 days)
How do I apply a sliding window on a matrix 23x1843200 with a window size 23x768??data.png
%% input
data matrix
DDD=load('data.mat');
data=DDD.data;
N_max=length(data);
window_size=256*3; %% 256 for 1 second ==> 3 seconds
step_win=128*3; %% overlapping window ...by 50%
count=0;
for n_start = 1:step_win:(N_max-window_size)
count=count+1;
segment=data(n_start:(n_start+ window_size-1));
end
plot(segment)
xlabel('time')
grid on;
title('last segment of channel1');

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!