title: How to shift Hamming windows in Matlab?
body: <p>I got this message whilst trying to build a program in Matlab:</p>
  
  <pre><code>Error:
  Subscript indices must either be real positive integers or logicals.
  
  Error in Untitled (line 17)
  x(pocz:kon) = x(pocz:kon) .* H;
  </code></pre>
  
  <p>I know that the index is wrong but i do not know how should it be. Could anyone help me ?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>clc;
  [x, fs, Nbits] = wavread('zero.wav'); % x -&gt; data sampling | fs -&gt; sampling freq | Nbits -&gt; bits per sample
  subplot(2,1,1); plot(x); title('asd');
  N = length(x); % 
  HamWin = 240; % size of Hamming Window
  ShiftHamWin = 180; % shift of Hamming windwow
  Frames = N/ShiftHamWin; % 
  %1. PREEMFAZA
  x = filter([1 -0.9735], 1, x);
  %----------------------------------------------------------------
  %2. OKNO
  %x = x - mean(x);
  beg= 0;
  en = 180;
  H = hamming(HamWin);
  while(beg &lt; N)
  x(beg:en) = x(beg:en) .* H;
  beg = round(en);
  en = round(en + 180);
  end;
  %-----------------------------------------------------------------
  subplot(2,1,2); plot(x);
  </code></pre>