title: Dimensionality reduction in Matlab
body: <p>I want to reduce the dimension of data to ndim dimensions in MATLAB. I am using <code>pcares</code> to reduce dimension but the result (i.e. residuals,reconstructed) has the same dimensions as the data and not <code>ndim</code>. How can I project the residuals to <code>ndim</code> dimensions only.</p>
  
  <pre><code>[residuals,reconstructed] = pcares(X,ndim)
  </code></pre>
  
  <p>Sample code</p>
  
  <pre><code>MU = [0 0];
  SIGMA = [4/3 2/3; 2/3 4/3];
  X = mvnrnd(MU,SIGMA,1000);
  [residuals,reconstructed] = pcares(X,1)
  </code></pre>
  
  <p>Now I expect the residuals to have 1 dimensions i.e. the data <code>X</code> projected to prime component as I specified it as <code>pcares(X,1)</code>. But here both residuals and reconstructed have the same of 2. </p>