title: Selecting odd numbers of rows and columns
body: <p>HI I have this Matlab code which is picking the odd number of rows and columns from Residuals Matrix. I would like to convert this piece of code from to Python. Could you please let me know if my code is correct.</p>
  
  <p>Matlab code:</p>
  
  <pre><code>NewRes(:,:,Channel,:) = Residuals([1:2:size(Residuals,1)],[1:2:size(Residuals,1)],Channel,:);
  </code></pre>
  
  <p>Python code:</p>
  
  <pre><code>NewRes[:, :, Channel, :] = Residuals(Residuals[::2], Residuals[::2], Channel, :)
  </code></pre>
  
  <p>Does my code represent the even number of rows and columns? How can be size(Residuals,1) can be considered.</p>
  
  <p>example output from matlab code</p>
  
  <pre><code>Residuals =
  
       1     2     3     4
       3     4     5     6
       8     9     3     1
  
  &gt;&gt;  Residuals([1:2:size(Residuals,1)],[1:2:size(Residuals,1)], :, :);
  &gt;&gt; Residuals
  
  Residuals =
  
       1     2     3     4
       3     4     5     6
       8     9     3     1
  
  &gt;&gt; Newres = Residuals([1:2:size(Residuals,1)],[1:2:size(Residuals,1)], :, :);
  &gt;&gt; Newres
  
  Newres =
  
       1     3
       8     3
  </code></pre>